1 |
742 |
jeremybenn |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2 |
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
3 |
|
|
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Writing and Generating Documentation</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/><meta name="keywords" content="ISO C++, documentation, style, docbook, doxygen"/><meta name="keywords" content=" ISO C++ , library "/><meta name="keywords" content=" ISO C++ , runtime , library "/><link rel="home" href="../index.html" title="The GNU C++ Library"/><link rel="up" href="appendix_porting.html" title="Appendix B. Porting and Maintenance"/><link rel="prev" href="appendix_porting.html" title="Appendix B. Porting and Maintenance"/><link rel="next" href="internals.html" title="Porting to New Hardware or Operating Systems"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Writing and Generating Documentation</th></tr><tr><td align="left"><a accesskey="p" href="appendix_porting.html">Prev</a> </td><th width="60%" align="center">Appendix B.
|
4 |
|
|
Porting and Maintenance
|
5 |
|
|
|
6 |
|
|
</th><td align="right"> <a accesskey="n" href="internals.html">Next</a></td></tr></table><hr/></div><div class="section" title="Writing and Generating Documentation"><div class="titlepage"><div><div><h2 class="title"><a id="appendix.porting.doc"/>Writing and Generating Documentation</h2></div></div></div><div class="section" title="Introduction"><div class="titlepage"><div><div><h3 class="title"><a id="doc.intro"/>Introduction</h3></div></div></div><p>
|
7 |
|
|
Documentation for the GNU C++ Library is created from three
|
8 |
|
|
independent sources: a manual, a FAQ, and an API reference.
|
9 |
|
|
</p><p>
|
10 |
|
|
The sub-directory <code class="filename">doc</code>
|
11 |
|
|
within the main source directory contains
|
12 |
|
|
<code class="filename">Makefile.am</code> and
|
13 |
|
|
<code class="filename">Makefile.in</code>, which provide rules for
|
14 |
|
|
generating documentation, described in excruciating detail
|
15 |
|
|
below. The <code class="filename">doc</code>
|
16 |
|
|
sub-directory also contains three directories: <code class="filename">doxygen</code>, which contains scripts and
|
17 |
|
|
fragments for <span class="command"><strong>doxygen</strong></span>, <code class="filename">html</code>, which contains an html
|
18 |
|
|
version of the manual, and <code class="filename">xml</code>, which contains an xml version
|
19 |
|
|
of the manual.
|
20 |
|
|
</p><p>
|
21 |
|
|
Diverging from established documentation conventions in the rest
|
22 |
|
|
of the GCC project, libstdc++ does not use Texinfo as a markup
|
23 |
|
|
language. Instead, Docbook is used to create the manual and the
|
24 |
|
|
FAQ, and Doxygen is used to construct the API
|
25 |
|
|
reference. Although divergent, this conforms to the GNU Project
|
26 |
|
|
recommendations as long as the output is of sufficient quality,
|
27 |
|
|
as per
|
28 |
|
|
<a class="link" href="http://www.gnu.org/prep/standards/standards.html#Documentation">
|
29 |
|
|
GNU Manuals</a>.
|
30 |
|
|
</p></div><div class="section" title="Generating Documentation"><div class="titlepage"><div><div><h3 class="title"><a id="doc.generation"/>Generating Documentation</h3></div></div></div><p>
|
31 |
|
|
Certain Makefile rules are required by the GNU Coding
|
32 |
|
|
Standards. These standard rules generate HTML, PDF, XML, or man
|
33 |
|
|
files. For each of the generative rules, there is an additional
|
34 |
|
|
install rule that is used to install any generated documentation
|
35 |
|
|
files into the prescribed installation directory. Files are
|
36 |
|
|
installed into <code class="filename">share/doc</code>
|
37 |
|
|
or <code class="filename">share/man</code> directories.
|
38 |
|
|
</p><p>
|
39 |
|
|
The standard Makefile rules are conditionally supported, based
|
40 |
|
|
on the results of examining the host environment for
|
41 |
|
|
prerequisites at configuration time. If requirements are not
|
42 |
|
|
found, the rule is aliased to a dummy rule that does nothing,
|
43 |
|
|
and produces no documentation. If the requirements are found,
|
44 |
|
|
the rule forwards to a private rule that produces the requested
|
45 |
|
|
documentation.
|
46 |
|
|
</p><p>
|
47 |
|
|
For more details on what prerequisites were found and where,
|
48 |
|
|
please consult the file <code class="filename">config.log</code> in the
|
49 |
|
|
libstdc++ build directory. Compare this log to what is expected
|
50 |
|
|
for the relevant Makefile conditionals:
|
51 |
|
|
<code class="literal">BUILD_INFO</code>, <code class="literal">BUILD_XML</code>,
|
52 |
|
|
<code class="literal">BUILD_HTML</code>, <code class="literal">BUILD_MAN</code>,
|
53 |
|
|
<code class="literal">BUILD_PDF</code>, and <code class="literal">BUILD_EPUB</code>.
|
54 |
|
|
</p><p>
|
55 |
|
|
Supported Makefile rules:
|
56 |
|
|
</p><div class="variablelist"><dl><dt><span class="term">
|
57 |
|
|
<span class="emphasis"><em>make html</em></span>
|
58 |
|
|
, </span><span class="term">
|
59 |
|
|
<span class="emphasis"><em>make install-html</em></span>
|
60 |
|
|
</span></dt><dd><p>
|
61 |
|
|
Generates multi-page HTML documentation, and installs it
|
62 |
|
|
in the following directories:
|
63 |
|
|
</p><p>
|
64 |
|
|
<code class="filename">
|
65 |
|
|
doc/libstdc++/libstdc++-api.html
|
66 |
|
|
</code>
|
67 |
|
|
</p><p>
|
68 |
|
|
<code class="filename">
|
69 |
|
|
doc/libstdc++/libstdc++-manual.html
|
70 |
|
|
</code>
|
71 |
|
|
</p></dd><dt><span class="term">
|
72 |
|
|
<span class="emphasis"><em>make pdf</em></span>
|
73 |
|
|
, </span><span class="term">
|
74 |
|
|
<span class="emphasis"><em>make install-pdf</em></span>
|
75 |
|
|
</span></dt><dd><p>
|
76 |
|
|
Generates indexed PDF documentation, and installs it as
|
77 |
|
|
the following files:
|
78 |
|
|
</p><p>
|
79 |
|
|
<code class="filename">doc/libstdc++/libstdc++-api.pdf</code>
|
80 |
|
|
</p><p>
|
81 |
|
|
<code class="filename">doc/libstdc++/libstdc++-manual.pdf</code>
|
82 |
|
|
</p></dd><dt><span class="term">
|
83 |
|
|
<span class="emphasis"><em>make man</em></span>
|
84 |
|
|
, </span><span class="term">
|
85 |
|
|
<span class="emphasis"><em>make install-man</em></span>
|
86 |
|
|
</span></dt><dd><p>
|
87 |
|
|
Generates man pages, and installs it in the following directory:
|
88 |
|
|
</p><p>
|
89 |
|
|
<code class="filename">man/man3/</code>
|
90 |
|
|
</p><p>
|
91 |
|
|
The generated man pages are namespace-qualified, so to look at
|
92 |
|
|
the man page for <code class="classname">vector</code>, one would use
|
93 |
|
|
<span class="command"><strong>man std::vector</strong></span>.
|
94 |
|
|
</p></dd><dt><span class="term">
|
95 |
|
|
<span class="emphasis"><em>make epub</em></span>
|
96 |
|
|
, </span><span class="term">
|
97 |
|
|
<span class="emphasis"><em>make install-epub</em></span>
|
98 |
|
|
</span></dt><dd><p>
|
99 |
|
|
Generates documentation in the ebook/portable electronic
|
100 |
|
|
reader format called Epub, and installs it as the
|
101 |
|
|
following file.
|
102 |
|
|
</p><p>
|
103 |
|
|
<code class="filename">doc/libstdc++/libstdc++-manual.epub</code>
|
104 |
|
|
</p></dd><dt><span class="term">
|
105 |
|
|
<span class="emphasis"><em>make xml</em></span>
|
106 |
|
|
, </span><span class="term">
|
107 |
|
|
<span class="emphasis"><em>make install-xml</em></span>
|
108 |
|
|
</span></dt><dd><p>
|
109 |
|
|
Generates single-file XML documentation, and installs it
|
110 |
|
|
as the following files:
|
111 |
|
|
</p><p>
|
112 |
|
|
<code class="filename">doc/libstdc++/libstdc++-api-single.xml</code>
|
113 |
|
|
</p><p>
|
114 |
|
|
<code class="filename">doc/libstdc++/libstdc++-manual-single.xml</code>
|
115 |
|
|
</p></dd></dl></div><p>
|
116 |
|
|
Makefile rules for several other formats are explicitly not
|
117 |
|
|
supported, and are always aliased to dummy rules. These
|
118 |
|
|
unsupported formats are: <span class="emphasis"><em>info</em></span>,
|
119 |
|
|
<span class="emphasis"><em>ps</em></span>, and <span class="emphasis"><em>dvi</em></span>.
|
120 |
|
|
</p></div><div class="section" title="Doxygen"><div class="titlepage"><div><div><h3 class="title"><a id="doc.doxygen"/>Doxygen</h3></div></div></div><div class="section" title="Prerequisites"><div class="titlepage"><div><div><h4 class="title"><a id="doxygen.prereq"/>Prerequisites</h4></div></div></div><div class="table"><a id="id553885"/><p class="title"><strong>Table B.1. Doxygen Prerequisites</strong></p><div class="table-contents"><table summary="Doxygen Prerequisites" border="1"><colgroup><col style="text-align: center" class="c1"/><col style="text-align: center" class="c2"/><col style="text-align: center" class="c3"/></colgroup><thead><tr><th style="text-align: center">Tool</th><th style="text-align: center">Version</th><th style="text-align: center">Required By</th></tr></thead><tbody><tr><td style="text-align: center">coreutils</td><td style="text-align: center">8.5</td><td style="text-align: center">all</td></tr><tr><td style="text-align: center">bash</td><td style="text-align: center">4.1</td><td style="text-align: center">all</td></tr><tr><td style="text-align: center">doxygen</td><td style="text-align: center">1.7.0</td><td style="text-align: center">all</td></tr><tr><td style="text-align: center">graphviz</td><td style="text-align: center">2.26</td><td style="text-align: center">graphical hierarchies</td></tr><tr><td style="text-align: center">pdflatex</td><td style="text-align: center">2007-59</td><td style="text-align: center">pdf output</td></tr></tbody></table></div></div><br class="table-break"/><p>
|
121 |
|
|
Prerequisite tools are Bash 2.0 or later,
|
122 |
|
|
<a class="link" href="http://www.doxygen.org/">Doxygen</a>, and
|
123 |
|
|
the <a class="link" href="http://www.gnu.org/software/coreutils/">GNU
|
124 |
|
|
coreutils</a>. (GNU versions of find, xargs, and possibly
|
125 |
|
|
sed and grep are used, just because the GNU versions make
|
126 |
|
|
things very easy.)
|
127 |
|
|
</p><p>
|
128 |
|
|
To generate the pretty pictures and hierarchy
|
129 |
|
|
graphs, the
|
130 |
|
|
<a class="link" href="http://www.graphviz.org">Graphviz</a> package
|
131 |
|
|
will need to be installed. For PDF
|
132 |
|
|
output, <a class="link" href="http://www.tug.org/applications/pdftex/">
|
133 |
|
|
pdflatex</a> is required.
|
134 |
|
|
</p></div><div class="section" title="Generating the Doxygen Files"><div class="titlepage"><div><div><h4 class="title"><a id="doxygen.rules"/>Generating the Doxygen Files</h4></div></div></div><p>
|
135 |
|
|
The following Makefile rules run Doxygen to generate HTML
|
136 |
|
|
docs, XML docs, XML docs as a single file, PDF docs, and the
|
137 |
|
|
man pages. These rules are not conditional! If the required
|
138 |
|
|
tools are not found, or are the wrong versions, the rule may
|
139 |
|
|
end in an error.
|
140 |
|
|
</p><p>
|
141 |
|
|
</p><pre class="screen"><strong class="userinput"><code>make doc-html-doxygen</code></strong></pre><p>
|
142 |
|
|
</p><p>
|
143 |
|
|
</p><pre class="screen"><strong class="userinput"><code>make doc-xml-doxygen</code></strong></pre><p>
|
144 |
|
|
</p><p>
|
145 |
|
|
</p><pre class="screen"><strong class="userinput"><code>make doc-xml-single-doxygen</code></strong></pre><p>
|
146 |
|
|
</p><p>
|
147 |
|
|
</p><pre class="screen"><strong class="userinput"><code>make doc-pdf-doxygen</code></strong></pre><p>
|
148 |
|
|
</p><p>
|
149 |
|
|
</p><pre class="screen"><strong class="userinput"><code>make doc-man-doxygen</code></strong></pre><p>
|
150 |
|
|
</p><p>
|
151 |
|
|
Generated files are output into separate sub directories of
|
152 |
|
|
<code class="filename">doc/doxygen/</code> in the
|
153 |
|
|
build directory, based on the output format. For instance, the
|
154 |
|
|
HTML docs will be in <code class="filename">doc/doxygen/html</code>.
|
155 |
|
|
</p><p>
|
156 |
|
|
Careful observers will see that the Makefile rules simply call
|
157 |
|
|
a script from the source tree, <code class="filename">run_doxygen</code>, which
|
158 |
|
|
does the actual work of running Doxygen and then (most
|
159 |
|
|
importantly) massaging the output files. If for some reason
|
160 |
|
|
you prefer to not go through the Makefile, you can call this
|
161 |
|
|
script directly. (Start by passing <code class="literal">--help</code>.)
|
162 |
|
|
</p><p>
|
163 |
|
|
If you wish to tweak the Doxygen settings, do so by editing
|
164 |
|
|
<code class="filename">doc/doxygen/user.cfg.in</code>. Notes to fellow
|
165 |
|
|
library hackers are written in triple-# comments.
|
166 |
|
|
</p></div><div class="section" title="Markup"><div class="titlepage"><div><div><h4 class="title"><a id="doxygen.markup"/>Markup</h4></div></div></div><p>
|
167 |
|
|
In general, libstdc++ files should be formatted according to
|
168 |
|
|
the rules found in the
|
169 |
|
|
<a class="link" href="source_code_style.html" title="Coding Style">Coding Standard</a>. Before
|
170 |
|
|
any doxygen-specific formatting tweaks are made, please try to
|
171 |
|
|
make sure that the initial formatting is sound.
|
172 |
|
|
</p><p>
|
173 |
|
|
Adding Doxygen markup to a file (informally called
|
174 |
|
|
<span class="quote">“<span class="quote">doxygenating</span>”</span>) is very simple. The Doxygen manual can be
|
175 |
|
|
found
|
176 |
|
|
<a class="link" href="http://www.stack.nl/~dimitri/doxygen/download.html#latestman">here</a>.
|
177 |
|
|
We try to use a very-recent version of Doxygen.
|
178 |
|
|
</p><p>
|
179 |
|
|
For classes, use
|
180 |
|
|
<code class="classname">deque</code>/<code class="classname">vector</code>/<code class="classname">list</code>
|
181 |
|
|
and <code class="classname">std::pair</code> as examples. For
|
182 |
|
|
functions, see their member functions, and the free functions
|
183 |
|
|
in <code class="filename">stl_algobase.h</code>. Member functions of
|
184 |
|
|
other container-like types should read similarly to these
|
185 |
|
|
member functions.
|
186 |
|
|
</p><p>
|
187 |
|
|
Some commentary to accompany
|
188 |
|
|
the first list in the <a class="link" href="http://www.stack.nl/~dimitri/doxygen/docblocks.html">Special
|
189 |
|
|
Documentation Blocks</a> section of
|
190 |
|
|
the Doxygen manual:
|
191 |
|
|
</p><div class="orderedlist"><ol class="orderedlist"><li class="listitem"><p>For longer comments, use the Javadoc style...</p></li><li class="listitem"><p>
|
192 |
|
|
...not the Qt style. The intermediate *'s are preferred.
|
193 |
|
|
</p></li><li class="listitem"><p>
|
194 |
|
|
Use the triple-slash style only for one-line comments (the
|
195 |
|
|
<span class="quote">“<span class="quote">brief</span>”</span> mode).
|
196 |
|
|
</p></li><li class="listitem"><p>
|
197 |
|
|
This is disgusting. Don't do this.
|
198 |
|
|
</p></li></ol></div><p>
|
199 |
|
|
Some specific guidelines:
|
200 |
|
|
</p><p>
|
201 |
|
|
Use the @-style of commands, not the !-style. Please be
|
202 |
|
|
careful about whitespace in your markup comments. Most of the
|
203 |
|
|
time it doesn't matter; doxygen absorbs most whitespace, and
|
204 |
|
|
both HTML and *roff are agnostic about whitespace. However,
|
205 |
|
|
in <pre> blocks and @code/@endcode sections, spacing can
|
206 |
|
|
have <span class="quote">“<span class="quote">interesting</span>”</span> effects.
|
207 |
|
|
</p><p>
|
208 |
|
|
Use either kind of grouping, as
|
209 |
|
|
appropriate. <code class="filename">doxygroups.cc</code> exists for this
|
210 |
|
|
purpose. See <code class="filename">stl_iterator.h</code> for a good example
|
211 |
|
|
of the <span class="quote">“<span class="quote">other</span>”</span> kind of grouping.
|
212 |
|
|
</p><p>
|
213 |
|
|
Please use markup tags like @p and @a when referring to things
|
214 |
|
|
such as the names of function parameters. Use @e for emphasis
|
215 |
|
|
when necessary. Use @c to refer to other standard names.
|
216 |
|
|
(Examples of all these abound in the present code.)
|
217 |
|
|
</p><p>
|
218 |
|
|
Complicated math functions should use the multi-line
|
219 |
|
|
format. An example from <code class="filename">random.h</code>:
|
220 |
|
|
</p><p>
|
221 |
|
|
</p><div class="literallayout"><p><br/>
|
222 |
|
|
/**<br/>
|
223 |
|
|
* @brief A model of a linear congruential random number generator.<br/>
|
224 |
|
|
*<br/>
|
225 |
|
|
* @f[<br/>
|
226 |
|
|
* x_{i+1}\leftarrow(ax_{i} + c) \bmod m<br/>
|
227 |
|
|
* @f]<br/>
|
228 |
|
|
*/<br/>
|
229 |
|
|
</p></div><p>
|
230 |
|
|
</p><p>
|
231 |
|
|
One area of note is the markup required for
|
232 |
|
|
<code class="literal">@file</code> markup in header files. Two details
|
233 |
|
|
are important: for filenames that have the same name in
|
234 |
|
|
multiple directories, include part of the installed path to
|
235 |
|
|
disambiguate. For example:
|
236 |
|
|
</p><p>
|
237 |
|
|
</p><div class="literallayout"><p><br/>
|
238 |
|
|
/** @file debug/vector<br/>
|
239 |
|
|
* This file is a GNU debug extension to the Standard C++ Library.<br/>
|
240 |
|
|
*/<br/>
|
241 |
|
|
</p></div><p>
|
242 |
|
|
</p><p>
|
243 |
|
|
The other relevant detail for header files is the use of a
|
244 |
|
|
libstdc++-specific doxygen alias that helps distinguish
|
245 |
|
|
between public header files (like <code class="filename">random</code>)
|
246 |
|
|
from implementation or private header files (like
|
247 |
|
|
<code class="filename">bits/c++config.h</code>.) This alias is spelled
|
248 |
|
|
<code class="literal">@headername</code> and can take one or two
|
249 |
|
|
arguments that detail the public header file or files that
|
250 |
|
|
should be included to use the contents of the file. All header
|
251 |
|
|
files that are not intended for direct inclusion must use
|
252 |
|
|
<code class="literal">headername</code> in the <code class="literal">file</code>
|
253 |
|
|
block. An example:
|
254 |
|
|
</p><p>
|
255 |
|
|
</p><div class="literallayout"><p><br/>
|
256 |
|
|
/** @file bits/basic_string.h<br/>
|
257 |
|
|
* This is an internal header file, included by other library headers.<br/>
|
258 |
|
|
* Do not attempt to use it directly. @headername{string}<br/>
|
259 |
|
|
*/<br/>
|
260 |
|
|
</p></div><p>
|
261 |
|
|
</p><p>
|
262 |
|
|
Be careful about using certain, special characters when
|
263 |
|
|
writing Doxygen comments. Single and double quotes, and
|
264 |
|
|
separators in filenames are two common trouble spots. When in
|
265 |
|
|
doubt, consult the following table.
|
266 |
|
|
</p><div class="table"><a id="id554388"/><p class="title"><strong>Table B.2. HTML to Doxygen Markup Comparison</strong></p><div class="table-contents"><table summary="HTML to Doxygen Markup Comparison" border="1"><colgroup><col style="text-align: left" class="c1"/><col style="text-align: left" class="c2"/></colgroup><thead><tr><th style="text-align: left">HTML</th><th style="text-align: left">Doxygen</th></tr></thead><tbody><tr><td style="text-align: left">\</td><td style="text-align: left">\\</td></tr><tr><td style="text-align: left">"</td><td style="text-align: left">\"</td></tr><tr><td style="text-align: left">'</td><td style="text-align: left">\'</td></tr><tr><td style="text-align: left"><i></td><td style="text-align: left">@a word</td></tr><tr><td style="text-align: left"><b></td><td style="text-align: left">@b word</td></tr><tr><td style="text-align: left"><code></td><td style="text-align: left">@c word</td></tr><tr><td style="text-align: left"><em></td><td style="text-align: left">@a word</td></tr><tr><td style="text-align: left"><em></td><td style="text-align: left"><em>two words or more</em></td></tr></tbody></table></div></div><br class="table-break"/></div></div><div class="section" title="Docbook"><div class="titlepage"><div><div><h3 class="title"><a id="doc.docbook"/>Docbook</h3></div></div></div><div class="section" title="Prerequisites"><div class="titlepage"><div><div><h4 class="title"><a id="docbook.prereq"/>Prerequisites</h4></div></div></div><div class="table"><a id="id554550"/><p class="title"><strong>Table B.3. Docbook Prerequisites</strong></p><div class="table-contents"><table summary="Docbook Prerequisites" border="1"><colgroup><col style="text-align: center" class="c1"/><col style="text-align: center" class="c2"/><col style="text-align: center" class="c3"/></colgroup><thead><tr><th style="text-align: center">Tool</th><th style="text-align: center">Version</th><th style="text-align: center">Required By</th></tr></thead><tbody><tr><td style="text-align: center">docbook5-style-xsl</td><td style="text-align: center">1.76.1</td><td style="text-align: center">all</td></tr><tr><td style="text-align: center">xsltproc</td><td style="text-align: center">1.1.26</td><td style="text-align: center">all</td></tr><tr><td style="text-align: center">xmllint</td><td style="text-align: center">2.7.7</td><td style="text-align: center">validation</td></tr><tr><td style="text-align: center">dblatex</td><td style="text-align: center">0.3</td><td style="text-align: center">pdf output</td></tr><tr><td style="text-align: center">pdflatex</td><td style="text-align: center">2007-59</td><td style="text-align: center">pdf output</td></tr><tr><td style="text-align: center">docbook2X</td><td style="text-align: center">0.8.8</td><td style="text-align: center">info output</td></tr><tr><td style="text-align: center">epub3 stylesheets</td><td style="text-align: center">b3</td><td style="text-align: center">epub output</td></tr></tbody></table></div></div><br class="table-break"/><p>
|
267 |
|
|
Editing the DocBook sources requires an XML editor. Many
|
268 |
|
|
exist: some notable options
|
269 |
|
|
include <span class="command"><strong>emacs</strong></span>, <span class="application">Kate</span>,
|
270 |
|
|
or <span class="application">Conglomerate</span>.
|
271 |
|
|
</p><p>
|
272 |
|
|
Some editors support special <span class="quote">“<span class="quote">XML Validation</span>”</span>
|
273 |
|
|
modes that can validate the file as it is
|
274 |
|
|
produced. Recommended is the <span class="command"><strong>nXML Mode</strong></span>
|
275 |
|
|
for <span class="command"><strong>emacs</strong></span>.
|
276 |
|
|
</p><p>
|
277 |
|
|
Besides an editor, additional DocBook files and XML tools are
|
278 |
|
|
also required.
|
279 |
|
|
</p><p>
|
280 |
|
|
Access to the DocBook 5.0 stylesheets and schema is required. The
|
281 |
|
|
stylesheets are usually packaged by vendor, in something
|
282 |
|
|
like <code class="filename">docbook5-style-xsl</code>. To exactly match
|
283 |
|
|
generated output, please use a version of the stylesheets
|
284 |
|
|
equivalent
|
285 |
|
|
to <code class="filename">docbook5-style-xsl-1.75.2-3</code>. The
|
286 |
|
|
installation directory for this package corresponds to
|
287 |
|
|
the <code class="literal">XSL_STYLE_DIR</code>
|
288 |
|
|
in <code class="filename">doc/Makefile.am</code> and defaults
|
289 |
|
|
to <code class="filename">/usr/share/sgml/docbook/xsl-ns-stylesheets</code>.
|
290 |
|
|
</p><p>
|
291 |
|
|
For processing XML, an XSLT processor and some style
|
292 |
|
|
sheets are necessary. Defaults are <span class="command"><strong>xsltproc</strong></span>
|
293 |
|
|
provided by <code class="filename">libxslt</code>.
|
294 |
|
|
</p><p>
|
295 |
|
|
For validating the XML document, you'll need
|
296 |
|
|
something like <span class="command"><strong>xmllint</strong></span> and access to the
|
297 |
|
|
relevant DocBook schema. These are provided
|
298 |
|
|
by a vendor package like <code class="filename">libxml2</code> and <code class="filename">docbook5-schemas-5.0-4</code>
|
299 |
|
|
</p><p>
|
300 |
|
|
For PDF output, something that transforms valid Docbook XML to PDF is
|
301 |
|
|
required. Possible solutions include <a class="link" href="http://dblatex.sourceforge.net">dblatex</a>,
|
302 |
|
|
<span class="command"><strong>xmlto</strong></span>, or <span class="command"><strong>prince</strong></span>. Of
|
303 |
|
|
these, <span class="command"><strong>dblatex</strong></span> is the default. Other
|
304 |
|
|
options are listed on the DocBook web <a class="link" href="http://wiki.docbook.org/topic/DocBookPublishingTools">pages</a>. Please
|
305 |
|
|
consult the <code class="email"><<a class="email" href="mailto:libstdc++@gcc.gnu.org">libstdc++@gcc.gnu.org</a>></code> list when
|
306 |
|
|
preparing printed manuals for current best practice and
|
307 |
|
|
suggestions.
|
308 |
|
|
</p><p>
|
309 |
|
|
For Texinfo output, something that transforms valid Docbook
|
310 |
|
|
XML to Texinfo is required. The default choice is <a class="link" href="http://docbook2x.sourceforge.net/">docbook2X</a>.
|
311 |
|
|
</p><p>
|
312 |
|
|
For epub output, the stylesheets for EPUB3 are required. These stylesheets are still in development. To validate the created file, epubcheck is necessary.
|
313 |
|
|
</p></div><div class="section" title="Generating the DocBook Files"><div class="titlepage"><div><div><h4 class="title"><a id="docbook.rules"/>Generating the DocBook Files</h4></div></div></div><p>
|
314 |
|
|
The following Makefile rules generate (in order): an HTML
|
315 |
|
|
version of all the DocBook documentation, a PDF version of the
|
316 |
|
|
same, and a single XML document. These rules are not
|
317 |
|
|
conditional! If the required tools are not found, or are the
|
318 |
|
|
wrong versions, the rule may end in an error.
|
319 |
|
|
</p><p>
|
320 |
|
|
</p><pre class="screen"><strong class="userinput"><code>make doc-html-docbook</code></strong></pre><p>
|
321 |
|
|
</p><p>
|
322 |
|
|
</p><pre class="screen"><strong class="userinput"><code>make doc-pdf-docbook</code></strong></pre><p>
|
323 |
|
|
</p><p>
|
324 |
|
|
</p><pre class="screen"><strong class="userinput"><code>make doc-xml-single-docbook</code></strong></pre><p>
|
325 |
|
|
</p><p>
|
326 |
|
|
Generated files are output into separate sub directores of
|
327 |
|
|
<code class="filename">doc/docbook/</code> in the
|
328 |
|
|
build directory, based on the output format. For instance, the
|
329 |
|
|
HTML docs will be in <code class="filename">doc/docbook/html</code>.
|
330 |
|
|
</p><p>
|
331 |
|
|
If the Docbook stylesheets are installed in a custom location,
|
332 |
|
|
one can use the variable <code class="literal">XSL_STYLE_DIR</code> to
|
333 |
|
|
override the Makefile defaults. For example:
|
334 |
|
|
</p><pre class="screen">
|
335 |
|
|
<strong class="userinput"><code>
|
336 |
|
|
make <code class="literal">XSL_STYLE_DIR="/usr/share/xml/docbook/stylesheet/nwalsh"</code> doc-html-docbook
|
337 |
|
|
</code></strong>
|
338 |
|
|
</pre></div><div class="section" title="Editing and Validation"><div class="titlepage"><div><div><h4 class="title"><a id="docbook.validation"/>Editing and Validation</h4></div></div></div><p>
|
339 |
|
|
After editing the xml sources, please make sure that the XML
|
340 |
|
|
documentation and markup is still valid. This can be
|
341 |
|
|
done easily, with the following validation rule:
|
342 |
|
|
</p><pre class="screen">
|
343 |
|
|
<strong class="userinput"><code>make doc-xml-validate-docbook</code></strong>
|
344 |
|
|
</pre><p>
|
345 |
|
|
This is equivalent to doing:
|
346 |
|
|
</p><pre class="screen">
|
347 |
|
|
<strong class="userinput"><code>
|
348 |
|
|
xmllint --noout --valid <code class="filename">xml/index.xml</code>
|
349 |
|
|
</code></strong>
|
350 |
|
|
</pre><p>
|
351 |
|
|
Please note that individual sections and chapters of the
|
352 |
|
|
manual can be validated by substituting the file desired for
|
353 |
|
|
<code class="filename">xml/index.xml</code> in the command
|
354 |
|
|
above. Reducing scope in this manner can be helpful when
|
355 |
|
|
validation on the entire manual fails.
|
356 |
|
|
</p><p>
|
357 |
|
|
All Docbook xml sources should always validate. No excuses!
|
358 |
|
|
</p></div><div class="section" title="File Organization and Basics"><div class="titlepage"><div><div><h4 class="title"><a id="docbook.examples"/>File Organization and Basics</h4></div></div></div><div class="literallayout"><p><br/>
|
359 |
|
|
<span class="emphasis"><em>Which files are important</em></span><br/>
|
360 |
|
|
<br/>
|
361 |
|
|
All Docbook files are in the directory<br/>
|
362 |
|
|
libstdc++-v3/doc/xml<br/>
|
363 |
|
|
<br/>
|
364 |
|
|
Inside this directory, the files of importance:<br/>
|
365 |
|
|
spine.xml - index to documentation set<br/>
|
366 |
|
|
manual/spine.xml - index to manual<br/>
|
367 |
|
|
manual/*.xml - individual chapters and sections of the manual<br/>
|
368 |
|
|
faq.xml - index to FAQ<br/>
|
369 |
|
|
api.xml - index to source level / API<br/>
|
370 |
|
|
<br/>
|
371 |
|
|
All *.txml files are template xml files, i.e., otherwise empty files with<br/>
|
372 |
|
|
the correct structure, suitable for filling in with new information.<br/>
|
373 |
|
|
<br/>
|
374 |
|
|
<span class="emphasis"><em>Canonical Writing Style</em></span><br/>
|
375 |
|
|
<br/>
|
376 |
|
|
class template<br/>
|
377 |
|
|
function template<br/>
|
378 |
|
|
member function template<br/>
|
379 |
|
|
(via C++ Templates, Vandevoorde)<br/>
|
380 |
|
|
<br/>
|
381 |
|
|
class in namespace std: allocator, not std::allocator<br/>
|
382 |
|
|
<br/>
|
383 |
|
|
header file: iostream, not <iostream><br/>
|
384 |
|
|
<br/>
|
385 |
|
|
<br/>
|
386 |
|
|
<span class="emphasis"><em>General structure</em></span><br/>
|
387 |
|
|
<br/>
|
388 |
|
|
<set><br/>
|
389 |
|
|
<book><br/>
|
390 |
|
|
</book><br/>
|
391 |
|
|
<br/>
|
392 |
|
|
<book><br/>
|
393 |
|
|
<chapter><br/>
|
394 |
|
|
</chapter><br/>
|
395 |
|
|
</book><br/>
|
396 |
|
|
<br/>
|
397 |
|
|
<book><br/>
|
398 |
|
|
<part><br/>
|
399 |
|
|
<chapter><br/>
|
400 |
|
|
<section><br/>
|
401 |
|
|
</section><br/>
|
402 |
|
|
<br/>
|
403 |
|
|
<sect1><br/>
|
404 |
|
|
</sect1><br/>
|
405 |
|
|
<br/>
|
406 |
|
|
<sect1><br/>
|
407 |
|
|
<sect2><br/>
|
408 |
|
|
</sect2><br/>
|
409 |
|
|
</sect1><br/>
|
410 |
|
|
</chapter><br/>
|
411 |
|
|
<br/>
|
412 |
|
|
<chapter><br/>
|
413 |
|
|
</chapter><br/>
|
414 |
|
|
</part><br/>
|
415 |
|
|
</book><br/>
|
416 |
|
|
<br/>
|
417 |
|
|
</set><br/>
|
418 |
|
|
</p></div></div><div class="section" title="Markup By Example"><div class="titlepage"><div><div><h4 class="title"><a id="docbook.markup"/>Markup By Example</h4></div></div></div><p>
|
419 |
|
|
Complete details on Docbook markup can be found in the DocBook
|
420 |
|
|
Element Reference,
|
421 |
|
|
<a class="link" href="http://www.docbook.org/tdg/en/html/part2.html">online</a>.
|
422 |
|
|
An incomplete reference for HTML to Docbook conversion is
|
423 |
|
|
detailed in the table below.
|
424 |
|
|
</p><div class="table"><a id="id555059"/><p class="title"><strong>Table B.4. HTML to Docbook XML Markup Comparison</strong></p><div class="table-contents"><table summary="HTML to Docbook XML Markup Comparison" border="1"><colgroup><col style="text-align: left" class="c1"/><col style="text-align: left" class="c2"/></colgroup><thead><tr><th style="text-align: left">HTML</th><th style="text-align: left">Docbook</th></tr></thead><tbody><tr><td style="text-align: left"><p></td><td style="text-align: left"><para></td></tr><tr><td style="text-align: left"><pre></td><td style="text-align: left"><computeroutput>, <programlisting>,
|
425 |
|
|
<literallayout></td></tr><tr><td style="text-align: left"><ul></td><td style="text-align: left"><itemizedlist></td></tr><tr><td style="text-align: left"><ol></td><td style="text-align: left"><orderedlist></td></tr><tr><td style="text-align: left"><il></td><td style="text-align: left"><listitem></td></tr><tr><td style="text-align: left"><dl></td><td style="text-align: left"><variablelist></td></tr><tr><td style="text-align: left"><dt></td><td style="text-align: left"><term></td></tr><tr><td style="text-align: left"><dd></td><td style="text-align: left"><listitem></td></tr><tr><td style="text-align: left"><a href=""></td><td style="text-align: left"><ulink url=""></td></tr><tr><td style="text-align: left"><code></td><td style="text-align: left"><literal>, <programlisting></td></tr><tr><td style="text-align: left"><strong></td><td style="text-align: left"><emphasis></td></tr><tr><td style="text-align: left"><em></td><td style="text-align: left"><emphasis></td></tr><tr><td style="text-align: left">"</td><td style="text-align: left"><quote></td></tr></tbody></table></div></div><br class="table-break"/><p>
|
426 |
|
|
And examples of detailed markup for which there are no real HTML
|
427 |
|
|
equivalents are listed in the table below.
|
428 |
|
|
</p><div class="table"><a id="id555261"/><p class="title"><strong>Table B.5. Docbook XML Element Use</strong></p><div class="table-contents"><table summary="Docbook XML Element Use" border="1"><colgroup><col style="text-align: left" class="c1"/><col style="text-align: left" class="c2"/></colgroup><thead><tr><th style="text-align: left">Element</th><th style="text-align: left">Use</th></tr></thead><tbody><tr><td style="text-align: left"><structname></td><td style="text-align: left"><structname>char_traits</structname></td></tr><tr><td style="text-align: left"><classname></td><td style="text-align: left"><classname>string</classname></td></tr><tr><td style="text-align: left"><function></td><td style="text-align: left">
|
429 |
|
|
<p><function>clear()</function></p>
|
430 |
|
|
<p><function>fs.clear()</function></p>
|
431 |
|
|
</td></tr><tr><td style="text-align: left"><type></td><td style="text-align: left"><type>long long</type></td></tr><tr><td style="text-align: left"><varname></td><td style="text-align: left"><varname>fs</varname></td></tr><tr><td style="text-align: left"><literal></td><td style="text-align: left">
|
432 |
|
|
<p><literal>-Weffc++</literal></p>
|
433 |
|
|
<p><literal>rel_ops</literal></p>
|
434 |
|
|
</td></tr><tr><td style="text-align: left"><constant></td><td style="text-align: left">
|
435 |
|
|
<p><constant>_GNU_SOURCE</constant></p>
|
436 |
|
|
<p><constant>3.0</constant></p>
|
437 |
|
|
</td></tr><tr><td style="text-align: left"><command></td><td style="text-align: left"><command>g++</command></td></tr><tr><td style="text-align: left"><errortext></td><td style="text-align: left"><errortext>In instantiation of</errortext></td></tr><tr><td style="text-align: left"><filename></td><td style="text-align: left">
|
438 |
|
|
<p><filename class="headerfile">ctype.h</filename></p>
|
439 |
|
|
<p><filename class="directory">/home/gcc/build</filename></p>
|
440 |
|
|
<p><filename class="libraryfile">libstdc++.so</filename></p>
|
441 |
|
|
</td></tr></tbody></table></div></div><br class="table-break"/></div></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="appendix_porting.html">Prev</a> </td><td align="center"><a accesskey="u" href="appendix_porting.html">Up</a></td><td align="right"> <a accesskey="n" href="internals.html">Next</a></td></tr><tr><td align="left" valign="top">Appendix B.
|
442 |
|
|
Porting and Maintenance
|
443 |
|
|
|
444 |
|
|
</td><td align="center"><a accesskey="h" href="../index.html">Home</a></td><td align="right" valign="top"> Porting to New Hardware or Operating Systems</td></tr></table></div></body></html>
|