11debfc3dSmrg<section xmlns="http://docbook.org/ns/docbook" version="5.0" 21debfc3dSmrg xml:id="appendix.porting.doc" xreflabel="Documentation Hacking"> 31debfc3dSmrg<?dbhtml filename="documentation_hacking.html"?> 41debfc3dSmrg 51debfc3dSmrg<info><title>Writing and Generating Documentation</title> 61debfc3dSmrg <keywordset> 71debfc3dSmrg <keyword>ISO C++</keyword> 81debfc3dSmrg <keyword>documentation</keyword> 91debfc3dSmrg <keyword>style</keyword> 101debfc3dSmrg <keyword>docbook</keyword> 111debfc3dSmrg <keyword>doxygen</keyword> 121debfc3dSmrg </keywordset> 131debfc3dSmrg</info> 141debfc3dSmrg 151debfc3dSmrg <section xml:id="doc.intro"> 161debfc3dSmrg <info> 171debfc3dSmrg <title>Introduction</title> 181debfc3dSmrg </info> 191debfc3dSmrg <para> 201debfc3dSmrg Documentation for the GNU C++ Library is created from three 211debfc3dSmrg independent sources: a manual, a FAQ, and an API reference. 221debfc3dSmrg </para> 231debfc3dSmrg <para> 241debfc3dSmrg The sub-directory <filename class="directory">doc</filename> 251debfc3dSmrg within the main source directory contains 261debfc3dSmrg <filename>Makefile.am</filename> and 271debfc3dSmrg <filename>Makefile.in</filename>, which provide rules for 281debfc3dSmrg generating documentation, described in excruciating detail 291debfc3dSmrg below. The <filename class="directory">doc</filename> 301debfc3dSmrg sub-directory also contains three directories: <filename 311debfc3dSmrg class="directory">doxygen</filename>, which contains scripts and 321debfc3dSmrg fragments for <command>doxygen</command>, <filename 331debfc3dSmrg class="directory">html</filename>, which contains an html 341debfc3dSmrg version of the manual, and <filename 351debfc3dSmrg class="directory">xml</filename>, which contains an xml version 361debfc3dSmrg of the manual. 371debfc3dSmrg </para> 381debfc3dSmrg <para> 391debfc3dSmrg Diverging from established documentation conventions in the rest 401debfc3dSmrg of the GCC project, libstdc++ does not use Texinfo as a markup 411debfc3dSmrg language. Instead, Docbook is used to create the manual and the 421debfc3dSmrg FAQ, and Doxygen is used to construct the API 431debfc3dSmrg reference. Although divergent, this conforms to the GNU Project 441debfc3dSmrg recommendations as long as the output is of sufficient quality, 451debfc3dSmrg as per 461debfc3dSmrg <link xmlns:xlink="http://www.w3.org/1999/xlink" 471debfc3dSmrg xlink:href="http://www.gnu.org/prep/standards/standards.html#Documentation"> 481debfc3dSmrg GNU Manuals</link>. 491debfc3dSmrg </para> 501debfc3dSmrg </section> 511debfc3dSmrg 521debfc3dSmrg <section xml:id="doc.generation"> 531debfc3dSmrg <info> 541debfc3dSmrg <title>Generating Documentation</title> 551debfc3dSmrg </info> 561debfc3dSmrg 571debfc3dSmrg <para> 581debfc3dSmrg Certain Makefile rules are required by the GNU Coding 591debfc3dSmrg Standards. These standard rules generate HTML, PDF, XML, or man 601debfc3dSmrg files. For each of the generative rules, there is an additional 611debfc3dSmrg install rule that is used to install any generated documentation 621debfc3dSmrg files into the prescribed installation directory. Files are 631debfc3dSmrg installed into <filename class="directory">share/doc</filename> 641debfc3dSmrg or <filename class="directory">share/man</filename> directories. 651debfc3dSmrg </para> 661debfc3dSmrg 671debfc3dSmrg <para> 681debfc3dSmrg The standard Makefile rules are conditionally supported, based 691debfc3dSmrg on the results of examining the host environment for 701debfc3dSmrg prerequisites at configuration time. If requirements are not 711debfc3dSmrg found, the rule is aliased to a dummy rule that does nothing, 721debfc3dSmrg and produces no documentation. If the requirements are found, 731debfc3dSmrg the rule forwards to a private rule that produces the requested 741debfc3dSmrg documentation. 751debfc3dSmrg </para> 761debfc3dSmrg 771debfc3dSmrg <para> 781debfc3dSmrg For more details on what prerequisites were found and where, 791debfc3dSmrg please consult the file <filename>config.log</filename> in the 801debfc3dSmrg libstdc++ build directory. Compare this log to what is expected 811debfc3dSmrg for the relevant Makefile conditionals: 821debfc3dSmrg <literal>BUILD_INFO</literal>, <literal>BUILD_XML</literal>, 831debfc3dSmrg <literal>BUILD_HTML</literal>, <literal>BUILD_MAN</literal>, 841debfc3dSmrg <literal>BUILD_PDF</literal>, and <literal>BUILD_EPUB</literal>. 851debfc3dSmrg </para> 861debfc3dSmrg 871debfc3dSmrg <para> 881debfc3dSmrg Supported Makefile rules: 891debfc3dSmrg </para> 901debfc3dSmrg 911debfc3dSmrg <variablelist> 921debfc3dSmrg <varlistentry> 931debfc3dSmrg <term> 941debfc3dSmrg <emphasis>make html</emphasis> 951debfc3dSmrg </term> 961debfc3dSmrg <term> 971debfc3dSmrg <emphasis>make install-html</emphasis> 981debfc3dSmrg </term> 991debfc3dSmrg <listitem> 1001debfc3dSmrg <para> 1011debfc3dSmrg Generates multi-page HTML documentation, and installs it 1021debfc3dSmrg in the following directories: 1031debfc3dSmrg </para> 1041debfc3dSmrg <para> 1051debfc3dSmrg <filename>doc/libstdc++/libstdc++-api.html</filename> 1061debfc3dSmrg </para> 1071debfc3dSmrg <para> 1081debfc3dSmrg <filename>doc/libstdc++/libstdc++-manual.html</filename> 1091debfc3dSmrg </para> 1101debfc3dSmrg </listitem> 1111debfc3dSmrg </varlistentry> 1121debfc3dSmrg 1131debfc3dSmrg <varlistentry> 1141debfc3dSmrg <term> 1151debfc3dSmrg <emphasis>make pdf</emphasis> 1161debfc3dSmrg </term> 1171debfc3dSmrg <term> 1181debfc3dSmrg <emphasis>make install-pdf</emphasis> 1191debfc3dSmrg </term> 1201debfc3dSmrg <listitem> 1211debfc3dSmrg <para> 1221debfc3dSmrg Generates indexed PDF documentation, and installs it as 1231debfc3dSmrg the following files: 1241debfc3dSmrg </para> 1251debfc3dSmrg <para> 1261debfc3dSmrg <filename>doc/libstdc++/libstdc++-api.pdf</filename> 1271debfc3dSmrg </para> 1281debfc3dSmrg <para> 1291debfc3dSmrg <filename>doc/libstdc++/libstdc++-manual.pdf</filename> 1301debfc3dSmrg </para> 1311debfc3dSmrg </listitem> 1321debfc3dSmrg </varlistentry> 1331debfc3dSmrg 1341debfc3dSmrg <varlistentry> 1351debfc3dSmrg <term> 1361debfc3dSmrg <emphasis>make man</emphasis> 1371debfc3dSmrg </term> 1381debfc3dSmrg <term> 1391debfc3dSmrg <emphasis>make install-man</emphasis> 1401debfc3dSmrg </term> 1411debfc3dSmrg <listitem> 1421debfc3dSmrg <para> 1431debfc3dSmrg Generates man pages, and installs it in the following directory: 1441debfc3dSmrg </para> 1451debfc3dSmrg <para> 1461debfc3dSmrg <filename class="directory">man/man3/</filename> 1471debfc3dSmrg </para> 1481debfc3dSmrg <para> 1491debfc3dSmrg The generated man pages are namespace-qualified, so to look at 1501debfc3dSmrg the man page for <classname>vector</classname>, one would use 1511debfc3dSmrg <command>man std::vector</command>. 1521debfc3dSmrg </para> 1531debfc3dSmrg </listitem> 1541debfc3dSmrg </varlistentry> 1551debfc3dSmrg 1561debfc3dSmrg <varlistentry> 1571debfc3dSmrg <term> 1581debfc3dSmrg <emphasis>make epub</emphasis> 1591debfc3dSmrg </term> 1601debfc3dSmrg <term> 1611debfc3dSmrg <emphasis>make install-epub</emphasis> 1621debfc3dSmrg </term> 1631debfc3dSmrg <listitem> 1641debfc3dSmrg <para> 1651debfc3dSmrg Generates documentation in the ebook/portable electronic 1661debfc3dSmrg reader format called Epub, and installs it as the 1671debfc3dSmrg following file. 1681debfc3dSmrg </para> 1691debfc3dSmrg <para> 1701debfc3dSmrg <filename>doc/libstdc++/libstdc++-manual.epub</filename> 1711debfc3dSmrg </para> 1721debfc3dSmrg </listitem> 1731debfc3dSmrg </varlistentry> 1741debfc3dSmrg 1751debfc3dSmrg <varlistentry> 1761debfc3dSmrg <term> 1771debfc3dSmrg <emphasis>make xml</emphasis> 1781debfc3dSmrg </term> 1791debfc3dSmrg <term> 1801debfc3dSmrg <emphasis>make install-xml</emphasis> 1811debfc3dSmrg </term> 1821debfc3dSmrg <listitem> 1831debfc3dSmrg <para> 1841debfc3dSmrg Generates single-file XML documentation, and installs it 1851debfc3dSmrg as the following files: 1861debfc3dSmrg </para> 1871debfc3dSmrg <para> 1881debfc3dSmrg <filename>doc/libstdc++/libstdc++-api-single.xml</filename> 1891debfc3dSmrg </para> 1901debfc3dSmrg <para> 1911debfc3dSmrg <filename>doc/libstdc++/libstdc++-manual-single.xml</filename> 1921debfc3dSmrg </para> 1931debfc3dSmrg </listitem> 1941debfc3dSmrg </varlistentry> 1951debfc3dSmrg </variablelist> 1961debfc3dSmrg 1971debfc3dSmrg <para> 1981debfc3dSmrg Makefile rules for several other formats are explicitly not 1991debfc3dSmrg supported, and are always aliased to dummy rules. These 2001debfc3dSmrg unsupported formats are: <emphasis>info</emphasis>, 2011debfc3dSmrg <emphasis>ps</emphasis>, and <emphasis>dvi</emphasis>. 2021debfc3dSmrg </para> 2031debfc3dSmrg </section> 2041debfc3dSmrg 2051debfc3dSmrg <section xml:id="doc.doxygen"><info><title>Doxygen</title></info> 2061debfc3dSmrg 2071debfc3dSmrg <section xml:id="doxygen.prereq"><info><title>Prerequisites</title></info> 2081debfc3dSmrg 2091debfc3dSmrg <table frame="all" xml:id="table.doxygen_prereq"> 2101debfc3dSmrg<title>Doxygen Prerequisites</title> 2111debfc3dSmrg 2121debfc3dSmrg<tgroup cols="3" align="center" colsep="1" rowsep="1"> 2131debfc3dSmrg<colspec colname="c1"/> 2141debfc3dSmrg<colspec colname="c2"/> 2151debfc3dSmrg<colspec colname="c3"/> 2161debfc3dSmrg 2171debfc3dSmrg <thead> 2181debfc3dSmrg <row> 2191debfc3dSmrg <entry>Tool</entry> 2201debfc3dSmrg <entry>Version</entry> 2211debfc3dSmrg <entry>Required By</entry> 2221debfc3dSmrg </row> 2231debfc3dSmrg </thead> 2241debfc3dSmrg 2251debfc3dSmrg <tbody> 2261debfc3dSmrg 2271debfc3dSmrg <row> 2281debfc3dSmrg <entry>coreutils</entry> 2291debfc3dSmrg <entry>8.5</entry> 2301debfc3dSmrg <entry>all</entry> 2311debfc3dSmrg </row> 2321debfc3dSmrg 2331debfc3dSmrg <row> 2341debfc3dSmrg <entry>bash</entry> 2351debfc3dSmrg <entry>4.1</entry> 2361debfc3dSmrg <entry>all</entry> 2371debfc3dSmrg </row> 2381debfc3dSmrg 2391debfc3dSmrg <row> 2401debfc3dSmrg <entry>doxygen</entry> 2411debfc3dSmrg <entry>1.7.6.1</entry> 2421debfc3dSmrg <entry>all</entry> 2431debfc3dSmrg </row> 2441debfc3dSmrg 2451debfc3dSmrg <row> 2461debfc3dSmrg <entry>graphviz</entry> 2471debfc3dSmrg <entry>2.26</entry> 2481debfc3dSmrg <entry>graphical hierarchies</entry> 2491debfc3dSmrg </row> 2501debfc3dSmrg 2511debfc3dSmrg <row> 2521debfc3dSmrg <entry>pdflatex</entry> 2531debfc3dSmrg <entry>2007-59</entry> 2541debfc3dSmrg <entry>pdf output</entry> 2551debfc3dSmrg </row> 2561debfc3dSmrg 2571debfc3dSmrg </tbody> 2581debfc3dSmrg</tgroup> 2591debfc3dSmrg</table> 2601debfc3dSmrg 2611debfc3dSmrg 2621debfc3dSmrg <para> 2631debfc3dSmrg Prerequisite tools are Bash 2.0 or later, 264*8feb0f0bSmrg <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.doxygen.nl">Doxygen</link>, and 2651debfc3dSmrg the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.gnu.org/software/coreutils/">GNU 2661debfc3dSmrg coreutils</link>. (GNU versions of find, xargs, and possibly 2671debfc3dSmrg sed and grep are used, just because the GNU versions make 2681debfc3dSmrg things very easy.) 2691debfc3dSmrg </para> 2701debfc3dSmrg 2711debfc3dSmrg <para> 2721debfc3dSmrg To generate the pretty pictures and hierarchy 2731debfc3dSmrg graphs, the 2741debfc3dSmrg <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.graphviz.org">Graphviz</link> package 2751debfc3dSmrg will need to be installed. For PDF 2761debfc3dSmrg output, <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.tug.org/applications/pdftex/"> 2771debfc3dSmrg pdflatex</link> is required as well as a number of TeX packages 2781debfc3dSmrg such as <package>texlive-xtab</package> and 2791debfc3dSmrg <package>texlive-tocloft</package>. 2801debfc3dSmrg </para> 2811debfc3dSmrg 2821debfc3dSmrg <para> 2831debfc3dSmrg Be warned the PDF file generated via doxygen is extremely 2841debfc3dSmrg large. At last count, the PDF file is over three thousand 2851debfc3dSmrg pages. Generating this document taxes the underlying TeX 2861debfc3dSmrg formatting system, and will require the expansion of TeX's memory 2871debfc3dSmrg capacity. Specifically, the <literal>pool_size</literal> 2881debfc3dSmrg variable in the configuration file <filename>texmf.cnf</filename> may 2891debfc3dSmrg need to be increased by a minimum factor of two. 2901debfc3dSmrg </para> 2911debfc3dSmrg </section> 2921debfc3dSmrg 2931debfc3dSmrg <section xml:id="doxygen.rules"><info><title>Generating the Doxygen Files</title></info> 2941debfc3dSmrg 2951debfc3dSmrg <para> 2961debfc3dSmrg The following Makefile rules run Doxygen to generate HTML 2971debfc3dSmrg docs, XML docs, XML docs as a single file, PDF docs, and the 2981debfc3dSmrg man pages. These rules are not conditional! If the required 2991debfc3dSmrg tools are not found, or are the wrong versions, the rule may 3001debfc3dSmrg end in an error. 3011debfc3dSmrg </para> 3021debfc3dSmrg 3031debfc3dSmrg <para> 3041debfc3dSmrg <screen><userinput>make doc-html-doxygen</userinput></screen> 3051debfc3dSmrg </para> 3061debfc3dSmrg 3071debfc3dSmrg <para> 3081debfc3dSmrg <screen><userinput>make doc-xml-doxygen</userinput></screen> 3091debfc3dSmrg </para> 3101debfc3dSmrg 3111debfc3dSmrg <para> 3121debfc3dSmrg <screen><userinput>make doc-xml-single-doxygen</userinput></screen> 3131debfc3dSmrg </para> 3141debfc3dSmrg 3151debfc3dSmrg <para> 3161debfc3dSmrg <screen><userinput>make doc-pdf-doxygen</userinput></screen> 3171debfc3dSmrg </para> 3181debfc3dSmrg 3191debfc3dSmrg <para> 3201debfc3dSmrg <screen><userinput>make doc-man-doxygen</userinput></screen> 3211debfc3dSmrg </para> 3221debfc3dSmrg 3231debfc3dSmrg <para> 3241debfc3dSmrg Generated files are output into separate sub directories of 3251debfc3dSmrg <filename class="directory">doc/doxygen/</filename> in the 3261debfc3dSmrg build directory, based on the output format. For instance, the 3271debfc3dSmrg HTML docs will be in <filename class="directory">doc/doxygen/html</filename>. 3281debfc3dSmrg </para> 3291debfc3dSmrg 3301debfc3dSmrg <para> 3311debfc3dSmrg Careful observers will see that the Makefile rules simply call 3321debfc3dSmrg a script from the source tree, <filename>run_doxygen</filename>, which 3331debfc3dSmrg does the actual work of running Doxygen and then (most 3341debfc3dSmrg importantly) massaging the output files. If for some reason 3351debfc3dSmrg you prefer to not go through the Makefile, you can call this 3361debfc3dSmrg script directly. (Start by passing <literal>--help</literal>.) 3371debfc3dSmrg </para> 3381debfc3dSmrg 3391debfc3dSmrg <para> 3401debfc3dSmrg If you wish to tweak the Doxygen settings, do so by editing 3411debfc3dSmrg <filename>doc/doxygen/user.cfg.in</filename>. Notes to fellow 3421debfc3dSmrg library hackers are written in triple-# comments. 3431debfc3dSmrg </para> 3441debfc3dSmrg 3451debfc3dSmrg </section> 3461debfc3dSmrg 3471debfc3dSmrg <section xml:id="doxygen.debug"> 3481debfc3dSmrg <info><title>Debugging Generation</title></info> 3491debfc3dSmrg 3501debfc3dSmrg <para> 3511debfc3dSmrg Sometimes, mis-configuration of the pre-requisite tools can 3521debfc3dSmrg lead to errors when attempting to build the 3531debfc3dSmrg documentation. Here are some of the obvious errors, and ways 3541debfc3dSmrg to fix some common issues that may appear quite cryptic. 3551debfc3dSmrg </para> 3561debfc3dSmrg 3571debfc3dSmrg <para> 3581debfc3dSmrg First, if using a rule like <code>make pdf</code>, try to 3591debfc3dSmrg narrow down the scope of the error to either docbook 3601debfc3dSmrg (<code>make doc-pdf-docbook</code>) or doxygen (<code>make 3611debfc3dSmrg doc-pdf-doxygen</code>). 3621debfc3dSmrg </para> 3631debfc3dSmrg <para> 3641debfc3dSmrg Working on the doxygen path only, closely examine the 3651debfc3dSmrg contents of the following build directory: <filename 3661debfc3dSmrg class="directory">build/target/libstdc++-v3/doc/doxygen/latex</filename>. 3671debfc3dSmrg Pay attention to three files enclosed within, annotated as follows. 3681debfc3dSmrg </para> 3691debfc3dSmrg<itemizedlist> 3701debfc3dSmrg 3711debfc3dSmrg<listitem> 3721debfc3dSmrg <para> 3731debfc3dSmrg <emphasis>refman.tex</emphasis> 3741debfc3dSmrg </para> 3751debfc3dSmrg 3761debfc3dSmrg <para> 3771debfc3dSmrg The actual latex file, or partial latex file. This is generated 3781debfc3dSmrg via <command>doxygen</command>, and is the LaTeX version of the 3791debfc3dSmrg Doxygen XML file <filename>libstdc++-api.xml</filename>. Go to a specific 3801debfc3dSmrg line, and look at the generated LaTeX, and try to deduce what 3811debfc3dSmrg markup in <filename>libstdc++-api.xml</filename> is causing it. 3821debfc3dSmrg </para> 3831debfc3dSmrg</listitem> 3841debfc3dSmrg 3851debfc3dSmrg<listitem> 3861debfc3dSmrg <para> 3871debfc3dSmrg <emphasis>refman.log</emphasis> 3881debfc3dSmrg </para> 3891debfc3dSmrg 3901debfc3dSmrg <para> 3911debfc3dSmrg A log created by <command>latex</command> as it processes the 3921debfc3dSmrg <filename>refman.tex</filename> file. If generating the PDF fails 3931debfc3dSmrg look at the end of this file for errors such as: 3941debfc3dSmrg <screen> 3951debfc3dSmrg ! LaTeX Error: File `xtab.sty' not found. 3961debfc3dSmrg </screen> 3971debfc3dSmrg This indicates a required TeX package is missing. For the example 3981debfc3dSmrg above the <package>texlive-xtab</package> package needs to be 3991debfc3dSmrg installed. 4001debfc3dSmrg </para> 4011debfc3dSmrg</listitem> 4021debfc3dSmrg 4031debfc3dSmrg<listitem> 4041debfc3dSmrg <para> 4051debfc3dSmrg <emphasis>refman.out</emphasis> 4061debfc3dSmrg </para> 4071debfc3dSmrg 4081debfc3dSmrg <para> 4091debfc3dSmrg A log of the compilation of the converted LaTeX form to PDF. This 4101debfc3dSmrg is a linear list, from the beginning of the 4111debfc3dSmrg <filename>refman.tex</filename> file: the last entry of this file 4121debfc3dSmrg should be the end of the LaTeX file. If it is truncated, then you 4131debfc3dSmrg know that the last entry is the last part of the generated LaTeX 4141debfc3dSmrg source file that is valid. Often this file contains an error with 4151debfc3dSmrg a specific line number of <filename>refman.tex</filename> that is 4161debfc3dSmrg incorrect, or will have clues at the end of the file with the dump 4171debfc3dSmrg of the memory usage of LaTeX. 4181debfc3dSmrg </para> 4191debfc3dSmrg</listitem> 4201debfc3dSmrg</itemizedlist> 4211debfc3dSmrg 4221debfc3dSmrg <para> 4231debfc3dSmrg If the error at hand is not obvious after examination, a 4241debfc3dSmrg fall-back strategy is to start commenting out the doxygen 4251debfc3dSmrg input sources, which can be found in 4261debfc3dSmrg <filename>doc/doxygen/user.cfg.in</filename>, look for the 4271debfc3dSmrg <literal>INPUT</literal> tag. Start by commenting out whole 4281debfc3dSmrg directories of header files, until the offending header is 4291debfc3dSmrg identified. Then, read the latex log files to try and find 4301debfc3dSmrg surround text, and look for that in the offending header. 4311debfc3dSmrg </para> 4321debfc3dSmrg 4331debfc3dSmrg </section> 4341debfc3dSmrg 4351debfc3dSmrg <section xml:id="doxygen.markup"><info><title>Markup</title></info> 4361debfc3dSmrg 4371debfc3dSmrg 4381debfc3dSmrg <para> 4391debfc3dSmrg In general, libstdc++ files should be formatted according to 4401debfc3dSmrg the rules found in the 4411debfc3dSmrg <link linkend="contrib.coding_style">Coding Standard</link>. Before 4421debfc3dSmrg any doxygen-specific formatting tweaks are made, please try to 4431debfc3dSmrg make sure that the initial formatting is sound. 4441debfc3dSmrg </para> 4451debfc3dSmrg 4461debfc3dSmrg <para> 4471debfc3dSmrg Adding Doxygen markup to a file (informally called 448*8feb0f0bSmrg <quote>doxygenating</quote>) is very simple. See the 449*8feb0f0bSmrg <link xmlns:xlink="http://www.w3.org/1999/xlink" 450*8feb0f0bSmrg xlink:href="http://www.doxygen.nl/download.html#latestman">Doxygen 451*8feb0f0bSmrg manual</link> for details. 4521debfc3dSmrg We try to use a very-recent version of Doxygen. 4531debfc3dSmrg </para> 4541debfc3dSmrg 4551debfc3dSmrg <para> 4561debfc3dSmrg For classes, use 4571debfc3dSmrg <classname>deque</classname>/<classname>vector</classname>/<classname>list</classname> 4581debfc3dSmrg and <classname>std::pair</classname> as examples. For 4591debfc3dSmrg functions, see their member functions, and the free functions 4601debfc3dSmrg in <filename class="headerfile">stl_algobase.h</filename>. Member 4611debfc3dSmrg functions of other container-like types should read similarly to 4621debfc3dSmrg these member functions. 4631debfc3dSmrg </para> 4641debfc3dSmrg 4651debfc3dSmrg <para> 4661debfc3dSmrg Some commentary to accompany 467*8feb0f0bSmrg the first list in the <link xmlns:xlink="http://www.w3.org/1999/xlink" 468*8feb0f0bSmrg xlink:href="http://www.doxygen.nl/manual/docblocks.html">Special 4691debfc3dSmrg Documentation Blocks</link> section of the Doxygen manual: 4701debfc3dSmrg </para> 4711debfc3dSmrg 4721debfc3dSmrg <orderedlist inheritnum="ignore" continuation="restarts"> 4731debfc3dSmrg <listitem> 4741debfc3dSmrg <para>For longer comments, use the Javadoc style...</para> 4751debfc3dSmrg </listitem> 4761debfc3dSmrg 4771debfc3dSmrg <listitem> 4781debfc3dSmrg <para> 4791debfc3dSmrg ...not the Qt style. The intermediate *'s are preferred. 4801debfc3dSmrg </para> 4811debfc3dSmrg </listitem> 4821debfc3dSmrg 4831debfc3dSmrg <listitem> 4841debfc3dSmrg <para> 4851debfc3dSmrg Use the triple-slash style only for one-line comments (the 4861debfc3dSmrg <quote>brief</quote> mode). 4871debfc3dSmrg </para> 4881debfc3dSmrg </listitem> 4891debfc3dSmrg 4901debfc3dSmrg <listitem> 4911debfc3dSmrg <para> 4921debfc3dSmrg This is disgusting. Don't do this. 4931debfc3dSmrg </para> 4941debfc3dSmrg </listitem> 4951debfc3dSmrg </orderedlist> 4961debfc3dSmrg 4971debfc3dSmrg <para> 4981debfc3dSmrg Some specific guidelines: 4991debfc3dSmrg </para> 5001debfc3dSmrg 5011debfc3dSmrg <para> 5021debfc3dSmrg Use the @-style of commands, not the !-style. Please be 5031debfc3dSmrg careful about whitespace in your markup comments. Most of the 5041debfc3dSmrg time it doesn't matter; doxygen absorbs most whitespace, and 5051debfc3dSmrg both HTML and *roff are agnostic about whitespace. However, 5061debfc3dSmrg in <pre> blocks and @code/@endcode sections, spacing can 5071debfc3dSmrg have <quote>interesting</quote> effects. 5081debfc3dSmrg </para> 5091debfc3dSmrg 5101debfc3dSmrg <para> 5111debfc3dSmrg Use either kind of grouping, as 5121debfc3dSmrg appropriate. <filename>doxygroups.cc</filename> exists for this 5131debfc3dSmrg purpose. See <filename class="headerfile">stl_iterator.h</filename> 5141debfc3dSmrg for a good example of the <quote>other</quote> kind of grouping. 5151debfc3dSmrg </para> 5161debfc3dSmrg 5171debfc3dSmrg <para> 5181debfc3dSmrg Please use markup tags like @p and @a when referring to things 5191debfc3dSmrg such as the names of function parameters. Use @e for emphasis 5201debfc3dSmrg when necessary. Use @c to refer to other standard names. 5211debfc3dSmrg (Examples of all these abound in the present code.) 5221debfc3dSmrg </para> 5231debfc3dSmrg 5241debfc3dSmrg <para> 5251debfc3dSmrg Complicated math functions should use the multi-line format. 5261debfc3dSmrg An example from <filename class="headerfile">random.h</filename>: 5271debfc3dSmrg </para> 5281debfc3dSmrg 5291debfc3dSmrg <para> 5301debfc3dSmrg<literallayout class="normal"> 5311debfc3dSmrg/** 5321debfc3dSmrg * @brief A model of a linear congruential random number generator. 5331debfc3dSmrg * 5341debfc3dSmrg * @f[ 5351debfc3dSmrg * x_{i+1}\leftarrow(ax_{i} + c) \bmod m 5361debfc3dSmrg * @f] 5371debfc3dSmrg */ 5381debfc3dSmrg</literallayout> 5391debfc3dSmrg </para> 5401debfc3dSmrg 5411debfc3dSmrg <para> 5421debfc3dSmrg One area of note is the markup required for 5431debfc3dSmrg <literal>@file</literal> markup in header files. Two details 5441debfc3dSmrg are important: for filenames that have the same name in 5451debfc3dSmrg multiple directories, include part of the installed path to 5461debfc3dSmrg disambiguate. For example: 5471debfc3dSmrg </para> 5481debfc3dSmrg 5491debfc3dSmrg <para> 5501debfc3dSmrg<literallayout class="normal"> 5511debfc3dSmrg/** @file debug/vector 5521debfc3dSmrg * This file is a GNU debug extension to the Standard C++ Library. 5531debfc3dSmrg */ 5541debfc3dSmrg</literallayout> 5551debfc3dSmrg </para> 5561debfc3dSmrg 5571debfc3dSmrg <para> 5581debfc3dSmrg The other relevant detail for header files is the use of a 5591debfc3dSmrg libstdc++-specific doxygen alias that helps distinguish 5601debfc3dSmrg between public header files (like <filename class="headerfile">random</filename>) 5611debfc3dSmrg from implementation or private header files (like 5621debfc3dSmrg <filename class="headerfile">bits/c++config.h</filename>.) This alias is spelled 5631debfc3dSmrg <literal>@headername</literal> and can take one or two 5641debfc3dSmrg arguments that detail the public header file or files that 5651debfc3dSmrg should be included to use the contents of the file. All header 5661debfc3dSmrg files that are not intended for direct inclusion must use 5671debfc3dSmrg <literal>headername</literal> in the <literal>file</literal> 5681debfc3dSmrg block. An example: 5691debfc3dSmrg </para> 5701debfc3dSmrg 5711debfc3dSmrg <para> 5721debfc3dSmrg<literallayout class="normal"> 5731debfc3dSmrg/** @file bits/basic_string.h 5741debfc3dSmrg * This is an internal header file, included by other library headers. 5751debfc3dSmrg * Do not attempt to use it directly. @headername{string} 5761debfc3dSmrg */ 5771debfc3dSmrg</literallayout> 5781debfc3dSmrg </para> 5791debfc3dSmrg 5801debfc3dSmrg <para> 5811debfc3dSmrg Be careful about using certain, special characters when 5821debfc3dSmrg writing Doxygen comments. Single and double quotes, and 5831debfc3dSmrg separators in filenames are two common trouble spots. When in 5841debfc3dSmrg doubt, consult the following table. 5851debfc3dSmrg </para> 5861debfc3dSmrg 5871debfc3dSmrg<table frame="all" xml:id="table.doxygen_cmp"> 5881debfc3dSmrg<title>HTML to Doxygen Markup Comparison</title> 5891debfc3dSmrg 5901debfc3dSmrg<tgroup cols="2" align="left" colsep="1" rowsep="1"> 5911debfc3dSmrg<colspec colname="c1"/> 5921debfc3dSmrg<colspec colname="c2"/> 5931debfc3dSmrg 5941debfc3dSmrg <thead> 5951debfc3dSmrg <row> 5961debfc3dSmrg <entry>HTML</entry> 5971debfc3dSmrg <entry>Doxygen</entry> 5981debfc3dSmrg </row> 5991debfc3dSmrg </thead> 6001debfc3dSmrg 6011debfc3dSmrg <tbody> 6021debfc3dSmrg <row> 6031debfc3dSmrg <entry>\</entry> 6041debfc3dSmrg <entry>\\</entry> 6051debfc3dSmrg </row> 6061debfc3dSmrg 6071debfc3dSmrg <row> 6081debfc3dSmrg <entry>"</entry> 6091debfc3dSmrg <entry>\"</entry> 6101debfc3dSmrg </row> 6111debfc3dSmrg 6121debfc3dSmrg <row> 6131debfc3dSmrg <entry>'</entry> 6141debfc3dSmrg <entry>\'</entry> 6151debfc3dSmrg </row> 6161debfc3dSmrg 6171debfc3dSmrg <row> 6181debfc3dSmrg <entry><i></entry> 6191debfc3dSmrg <entry>@a word</entry> 6201debfc3dSmrg </row> 6211debfc3dSmrg 6221debfc3dSmrg <row> 6231debfc3dSmrg <entry><b></entry> 6241debfc3dSmrg <entry>@b word</entry> 6251debfc3dSmrg </row> 6261debfc3dSmrg 6271debfc3dSmrg <row> 6281debfc3dSmrg <entry><code></entry> 6291debfc3dSmrg <entry>@c word</entry> 6301debfc3dSmrg </row> 6311debfc3dSmrg 6321debfc3dSmrg <row> 6331debfc3dSmrg <entry><em></entry> 6341debfc3dSmrg <entry>@a word</entry> 6351debfc3dSmrg </row> 6361debfc3dSmrg 6371debfc3dSmrg <row> 6381debfc3dSmrg <entry><em></entry> 6391debfc3dSmrg <entry><em>two words or more</em></entry> 6401debfc3dSmrg </row> 6411debfc3dSmrg </tbody> 6421debfc3dSmrg 6431debfc3dSmrg</tgroup> 6441debfc3dSmrg</table> 6451debfc3dSmrg 6461debfc3dSmrg 6471debfc3dSmrg </section> 6481debfc3dSmrg 6491debfc3dSmrg </section> 6501debfc3dSmrg 6511debfc3dSmrg <section xml:id="doc.docbook"><info><title>Docbook</title></info> 6521debfc3dSmrg 6531debfc3dSmrg 6541debfc3dSmrg <section xml:id="docbook.prereq"><info><title>Prerequisites</title></info> 6551debfc3dSmrg 6561debfc3dSmrg 6571debfc3dSmrg <table frame="all" xml:id="table.docbook_prereq"> 6581debfc3dSmrg<title>Docbook Prerequisites</title> 6591debfc3dSmrg 6601debfc3dSmrg<tgroup cols="3" align="center" colsep="1" rowsep="1"> 6611debfc3dSmrg<colspec colname="c1"/> 6621debfc3dSmrg<colspec colname="c2"/> 6631debfc3dSmrg<colspec colname="c3"/> 6641debfc3dSmrg 6651debfc3dSmrg <thead> 6661debfc3dSmrg <row> 6671debfc3dSmrg <entry>Tool</entry> 6681debfc3dSmrg <entry>Version</entry> 6691debfc3dSmrg <entry>Required By</entry> 6701debfc3dSmrg </row> 6711debfc3dSmrg </thead> 6721debfc3dSmrg 6731debfc3dSmrg <tbody> 6741debfc3dSmrg 6751debfc3dSmrg <row> 6761debfc3dSmrg <entry>docbook5-style-xsl</entry> 6771debfc3dSmrg <entry>1.76.1</entry> 6781debfc3dSmrg <entry>all</entry> 6791debfc3dSmrg </row> 6801debfc3dSmrg 6811debfc3dSmrg <row> 6821debfc3dSmrg <entry>xsltproc</entry> 6831debfc3dSmrg <entry>1.1.26</entry> 6841debfc3dSmrg <entry>all</entry> 6851debfc3dSmrg </row> 6861debfc3dSmrg 6871debfc3dSmrg <row> 6881debfc3dSmrg <entry>xmllint</entry> 6891debfc3dSmrg <entry>2.7.7</entry> 6901debfc3dSmrg <entry>validation</entry> 6911debfc3dSmrg </row> 6921debfc3dSmrg 6931debfc3dSmrg <row> 6941debfc3dSmrg <entry>dblatex</entry> 6951debfc3dSmrg <entry>0.3</entry> 6961debfc3dSmrg <entry>pdf output</entry> 6971debfc3dSmrg </row> 6981debfc3dSmrg 6991debfc3dSmrg <row> 7001debfc3dSmrg <entry>pdflatex</entry> 7011debfc3dSmrg <entry>2007-59</entry> 7021debfc3dSmrg <entry>pdf output</entry> 7031debfc3dSmrg </row> 7041debfc3dSmrg 7051debfc3dSmrg <row> 7061debfc3dSmrg <entry>docbook2X</entry> 7071debfc3dSmrg <entry>0.8.8</entry> 7081debfc3dSmrg <entry>info output</entry> 7091debfc3dSmrg </row> 7101debfc3dSmrg 7111debfc3dSmrg <row> 7121debfc3dSmrg <entry>epub3 stylesheets</entry> 7131debfc3dSmrg <entry>b3</entry> 7141debfc3dSmrg <entry>epub output</entry> 7151debfc3dSmrg </row> 7161debfc3dSmrg 7171debfc3dSmrg </tbody> 7181debfc3dSmrg</tgroup> 7191debfc3dSmrg</table> 7201debfc3dSmrg 7211debfc3dSmrg <para> 7221debfc3dSmrg Editing the DocBook sources requires an XML editor. Many 7231debfc3dSmrg exist: some notable options 7241debfc3dSmrg include <command>emacs</command>, <application>Kate</application>, 7251debfc3dSmrg or <application>Conglomerate</application>. 7261debfc3dSmrg </para> 7271debfc3dSmrg 7281debfc3dSmrg <para> 7291debfc3dSmrg Some editors support special <quote>XML Validation</quote> 7301debfc3dSmrg modes that can validate the file as it is 7311debfc3dSmrg produced. Recommended is the <command>nXML Mode</command> 7321debfc3dSmrg for <command>emacs</command>. 7331debfc3dSmrg </para> 7341debfc3dSmrg 7351debfc3dSmrg <para> 7361debfc3dSmrg Besides an editor, additional DocBook files and XML tools are 7371debfc3dSmrg also required. 7381debfc3dSmrg </para> 7391debfc3dSmrg 7401debfc3dSmrg <para> 7411debfc3dSmrg Access to the DocBook 5.0 stylesheets and schema is required. The 7421debfc3dSmrg stylesheets are usually packaged by vendor, in something 7431debfc3dSmrg like <filename>docbook5-style-xsl</filename>. To exactly match 7441debfc3dSmrg generated output, please use a version of the stylesheets 7451debfc3dSmrg equivalent 7461debfc3dSmrg to <filename>docbook5-style-xsl-1.75.2-3</filename>. The 7471debfc3dSmrg installation directory for this package corresponds to 7481debfc3dSmrg the <literal>XSL_STYLE_DIR</literal> 7491debfc3dSmrg in <filename>doc/Makefile.am</filename> and defaults 7501debfc3dSmrg to <filename class="directory">/usr/share/sgml/docbook/xsl-ns-stylesheets</filename>. 7511debfc3dSmrg </para> 7521debfc3dSmrg 7531debfc3dSmrg <para> 7541debfc3dSmrg For processing XML, an XSLT processor and some style 7551debfc3dSmrg sheets are necessary. Defaults are <command>xsltproc</command> 7561debfc3dSmrg provided by <filename>libxslt</filename>. 7571debfc3dSmrg </para> 7581debfc3dSmrg 7591debfc3dSmrg <para> 7601debfc3dSmrg For validating the XML document, you'll need 7611debfc3dSmrg something like <command>xmllint</command> and access to the 7621debfc3dSmrg relevant DocBook schema. These are provided 7631debfc3dSmrg by a vendor package like <filename>libxml2</filename> and <filename>docbook5-schemas-5.0-4</filename> 7641debfc3dSmrg </para> 7651debfc3dSmrg 7661debfc3dSmrg <para> 7671debfc3dSmrg For PDF output, something that transforms valid Docbook XML to PDF is 7681debfc3dSmrg required. Possible solutions include <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dblatex.sourceforge.net">dblatex</link>, 7691debfc3dSmrg <command>xmlto</command>, or <command>prince</command>. Of 7701debfc3dSmrg these, <command>dblatex</command> is the default. 7711debfc3dSmrg Please consult the <email>libstdc++@gcc.gnu.org</email> list when 7721debfc3dSmrg preparing printed manuals for current best practice and 7731debfc3dSmrg suggestions. 7741debfc3dSmrg </para> 7751debfc3dSmrg 7761debfc3dSmrg <para> 7771debfc3dSmrg For Texinfo output, something that transforms valid Docbook 7781debfc3dSmrg XML to Texinfo is required. The default choice is <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://docbook2x.sourceforge.net/">docbook2X</link>. 7791debfc3dSmrg </para> 7801debfc3dSmrg 7811debfc3dSmrg <para> 782c0a68be4Smrg For epub output, the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://sourceforge.net/projects/docbook/files/epub3/">stylesheets</link> for EPUB3 are required. These stylesheets are still in development. To validate the created file, <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://github.com/w3c/epubcheck">epubcheck</link> is necessary. 7831debfc3dSmrg </para> 7841debfc3dSmrg </section> 7851debfc3dSmrg 7861debfc3dSmrg <section xml:id="docbook.rules"><info><title>Generating the DocBook Files</title></info> 7871debfc3dSmrg 7881debfc3dSmrg 7891debfc3dSmrg <para> 7901debfc3dSmrg The following Makefile rules generate (in order): an HTML 7911debfc3dSmrg version of all the DocBook documentation, a PDF version of the 7921debfc3dSmrg same, and a single XML document. These rules are not 7931debfc3dSmrg conditional! If the required tools are not found, or are the 7941debfc3dSmrg wrong versions, the rule may end in an error. 7951debfc3dSmrg </para> 7961debfc3dSmrg 7971debfc3dSmrg <para> 7981debfc3dSmrg <screen><userinput>make doc-html-docbook</userinput></screen> 7991debfc3dSmrg </para> 8001debfc3dSmrg 8011debfc3dSmrg <para> 8021debfc3dSmrg <screen><userinput>make doc-pdf-docbook</userinput></screen> 8031debfc3dSmrg </para> 8041debfc3dSmrg 8051debfc3dSmrg <para> 8061debfc3dSmrg <screen><userinput>make doc-xml-single-docbook</userinput></screen> 8071debfc3dSmrg </para> 8081debfc3dSmrg 8091debfc3dSmrg <para> 810a2dc1f3fSmrg Generated files are output into separate sub-directores of 8111debfc3dSmrg <filename class="directory">doc/docbook/</filename> in the 8121debfc3dSmrg build directory, based on the output format. For instance, the 8131debfc3dSmrg HTML docs will be in <filename 8141debfc3dSmrg class="directory">doc/docbook/html</filename>. 8151debfc3dSmrg </para> 8161debfc3dSmrg 8171debfc3dSmrg <para> 818a2dc1f3fSmrg The <screen>doc-html-docbook-regenerate</screen> target will generate 819a2dc1f3fSmrg the HTML files and copy them back to the libstdc++ source tree. 820a2dc1f3fSmrg This can be used to update the HTML files that are checked in to 821a2dc1f3fSmrg version control. 822a2dc1f3fSmrg </para> 823a2dc1f3fSmrg 824a2dc1f3fSmrg <para> 8251debfc3dSmrg If the Docbook stylesheets are installed in a custom location, 8261debfc3dSmrg one can use the variable <literal>XSL_STYLE_DIR</literal> to 8271debfc3dSmrg override the Makefile defaults. For example: 8281debfc3dSmrg </para> 8291debfc3dSmrg 8301debfc3dSmrg <screen> 8311debfc3dSmrg <userinput> 8321debfc3dSmrgmake <literal>XSL_STYLE_DIR="/usr/share/xml/docbook/stylesheet/nwalsh"</literal> doc-html-docbook 8331debfc3dSmrg </userinput> 8341debfc3dSmrg </screen> 8351debfc3dSmrg 8361debfc3dSmrg </section> 8371debfc3dSmrg 8381debfc3dSmrg <section xml:id="docbook.debug"> 8391debfc3dSmrg <info><title>Debugging Generation</title></info> 8401debfc3dSmrg 8411debfc3dSmrg <para> 8421debfc3dSmrg Sometimes, mis-configuration of the pre-requisite tools can 8431debfc3dSmrg lead to errors when attempting to build the 8441debfc3dSmrg documentation. Here are some of the obvious errors, and ways 8451debfc3dSmrg to fix some common issues that may appear quite cryptic. 8461debfc3dSmrg </para> 8471debfc3dSmrg 8481debfc3dSmrg <para> 8491debfc3dSmrg First, if using a rule like <code>make pdf</code>, try to 8501debfc3dSmrg narrow down the scope of the error to either docbook 8511debfc3dSmrg (<code>make doc-pdf-docbook</code>) or doxygen (<code>make 8521debfc3dSmrg doc-pdf-doxygen</code>). 8531debfc3dSmrg </para> 8541debfc3dSmrg 8551debfc3dSmrg <para> 8561debfc3dSmrg Working on the docbook path only, closely examine the 8571debfc3dSmrg contents of the following build directory: 8581debfc3dSmrg <filename class="directory">build/target/libstdc++-v3/doc/docbook/latex</filename>. 8591debfc3dSmrg Pay attention to three files enclosed within, annotated as follows. 8601debfc3dSmrg </para> 8611debfc3dSmrg 8621debfc3dSmrg<itemizedlist> 8631debfc3dSmrg 8641debfc3dSmrg<listitem> 8651debfc3dSmrg <para> 8661debfc3dSmrg <emphasis>spine.tex</emphasis> 8671debfc3dSmrg </para> 8681debfc3dSmrg 8691debfc3dSmrg <para> 8701debfc3dSmrg The actual latex file, or partial latex file. This is generated 8711debfc3dSmrg via <command>dblatex</command>, and is the LaTeX version of the 8721debfc3dSmrg DocBook XML file <filename>spine.xml</filename>. Go to a specific 8731debfc3dSmrg line, and look at the generated LaTeX, and try to deduce what 8741debfc3dSmrg markup in <filename>spine.xml</filename> is causing it. 8751debfc3dSmrg </para> 8761debfc3dSmrg</listitem> 8771debfc3dSmrg 8781debfc3dSmrg<listitem> 8791debfc3dSmrg <para> 8801debfc3dSmrg <emphasis>spine.out</emphasis> 8811debfc3dSmrg </para> 8821debfc3dSmrg 8831debfc3dSmrg <para> 8841debfc3dSmrg A log of the conversion from the XML form to the LaTeX form. This 8851debfc3dSmrg is a linear list, from the beginning of the 8861debfc3dSmrg <filename>spine.xml</filename> file: the last entry of this file 8871debfc3dSmrg should be the end of the DocBook file. If it is truncated, then 8881debfc3dSmrg you know that the last entry is the last part of the XML source 8891debfc3dSmrg file that is valid. The error is after this point. 8901debfc3dSmrg </para> 8911debfc3dSmrg</listitem> 8921debfc3dSmrg 8931debfc3dSmrg 8941debfc3dSmrg<listitem> 8951debfc3dSmrg <para> 8961debfc3dSmrg <emphasis>spine.log</emphasis> 8971debfc3dSmrg </para> 8981debfc3dSmrg 8991debfc3dSmrg <para> 9001debfc3dSmrg A log of the compilation of the converted LaTeX form to pdf. This 9011debfc3dSmrg is a linear list, from the beginning of the 9021debfc3dSmrg <filename>spine.tex</filename> file: the last entry of this file 9031debfc3dSmrg should be the end of the LaTeX file. If it is truncated, then you 9041debfc3dSmrg know that the last entry is the last part of the generated LaTeX 9051debfc3dSmrg source file that is valid. Often this file contains an error with 9061debfc3dSmrg a specific line number of <filename>spine.tex</filename> that is 9071debfc3dSmrg incorrect. 9081debfc3dSmrg </para> 9091debfc3dSmrg</listitem> 9101debfc3dSmrg 9111debfc3dSmrg</itemizedlist> 9121debfc3dSmrg 9131debfc3dSmrg <para> 9141debfc3dSmrg If the error at hand is not obvious after examination, or if one 9151debfc3dSmrg encounters the inscruitable <quote>Incomplete 9161debfc3dSmrg \ifmmode</quote> error, a fall-back strategy is to start 9171debfc3dSmrg commenting out parts of the XML document (regardless of what 9181debfc3dSmrg this does to over-all document validity). Start by 9191debfc3dSmrg commenting out each of the largest parts of the 9201debfc3dSmrg <filename>spine.xml</filename> file, section by section, 9211debfc3dSmrg until the offending section is identified. 9221debfc3dSmrg </para> 9231debfc3dSmrg 9241debfc3dSmrg 9251debfc3dSmrg </section> 9261debfc3dSmrg 9271debfc3dSmrg <section xml:id="docbook.validation"><info><title>Editing and Validation</title></info> 9281debfc3dSmrg 9291debfc3dSmrg <para> 9301debfc3dSmrg After editing the xml sources, please make sure that the XML 9311debfc3dSmrg documentation and markup is still valid. This can be 9321debfc3dSmrg done easily, with the following validation rule: 9331debfc3dSmrg </para> 9341debfc3dSmrg 9351debfc3dSmrg <screen> 9361debfc3dSmrg <userinput>make doc-xml-validate-docbook</userinput> 9371debfc3dSmrg </screen> 9381debfc3dSmrg 9391debfc3dSmrg <para> 9401debfc3dSmrg This is equivalent to doing: 9411debfc3dSmrg </para> 9421debfc3dSmrg 9431debfc3dSmrg <screen> 9441debfc3dSmrg <userinput> 9451debfc3dSmrg xmllint --noout --valid <filename>xml/index.xml</filename> 9461debfc3dSmrg </userinput> 9471debfc3dSmrg </screen> 9481debfc3dSmrg 9491debfc3dSmrg <para> 9501debfc3dSmrg Please note that individual sections and chapters of the 9511debfc3dSmrg manual can be validated by substituting the file desired for 9521debfc3dSmrg <filename>xml/index.xml</filename> in the command 9531debfc3dSmrg above. Reducing scope in this manner can be helpful when 9541debfc3dSmrg validation on the entire manual fails. 9551debfc3dSmrg </para> 9561debfc3dSmrg 9571debfc3dSmrg <para> 9581debfc3dSmrg All Docbook xml sources should always validate. No excuses! 9591debfc3dSmrg </para> 9601debfc3dSmrg 9611debfc3dSmrg </section> 9621debfc3dSmrg 9631debfc3dSmrg <section xml:id="docbook.examples"><info><title>File Organization and Basics</title></info> 9641debfc3dSmrg 9651debfc3dSmrg 9661debfc3dSmrg <literallayout class="normal"> 9671debfc3dSmrg <emphasis>Which files are important</emphasis> 9681debfc3dSmrg 9691debfc3dSmrg All Docbook files are in the directory 9701debfc3dSmrg libstdc++-v3/doc/xml 9711debfc3dSmrg 9721debfc3dSmrg Inside this directory, the files of importance: 9731debfc3dSmrg spine.xml - index to documentation set 9741debfc3dSmrg manual/spine.xml - index to manual 9751debfc3dSmrg manual/*.xml - individual chapters and sections of the manual 9761debfc3dSmrg faq.xml - index to FAQ 9771debfc3dSmrg api.xml - index to source level / API 9781debfc3dSmrg 9791debfc3dSmrg All *.txml files are template xml files, i.e., otherwise empty files with 9801debfc3dSmrg the correct structure, suitable for filling in with new information. 9811debfc3dSmrg 9821debfc3dSmrg <emphasis>Canonical Writing Style</emphasis> 9831debfc3dSmrg 9841debfc3dSmrg class template 9851debfc3dSmrg function template 9861debfc3dSmrg member function template 9871debfc3dSmrg (via C++ Templates, Vandevoorde) 9881debfc3dSmrg 9891debfc3dSmrg class in namespace std: allocator, not std::allocator 9901debfc3dSmrg 9911debfc3dSmrg header file: iostream, not <iostream> 9921debfc3dSmrg 9931debfc3dSmrg 9941debfc3dSmrg <emphasis>General structure</emphasis> 9951debfc3dSmrg 9961debfc3dSmrg <set> 9971debfc3dSmrg <book> 9981debfc3dSmrg </book> 9991debfc3dSmrg 10001debfc3dSmrg <book> 10011debfc3dSmrg <chapter> 10021debfc3dSmrg </chapter> 10031debfc3dSmrg </book> 10041debfc3dSmrg 10051debfc3dSmrg <book> 10061debfc3dSmrg <part> 10071debfc3dSmrg <chapter> 10081debfc3dSmrg <section> 10091debfc3dSmrg </section> 10101debfc3dSmrg 10111debfc3dSmrg <sect1> 10121debfc3dSmrg </sect1> 10131debfc3dSmrg 10141debfc3dSmrg <sect1> 10151debfc3dSmrg <sect2> 10161debfc3dSmrg </sect2> 10171debfc3dSmrg </sect1> 10181debfc3dSmrg </chapter> 10191debfc3dSmrg 10201debfc3dSmrg <chapter> 10211debfc3dSmrg </chapter> 10221debfc3dSmrg </part> 10231debfc3dSmrg </book> 10241debfc3dSmrg 10251debfc3dSmrg </set> 10261debfc3dSmrg </literallayout> 10271debfc3dSmrg </section> 10281debfc3dSmrg 10291debfc3dSmrg <section xml:id="docbook.markup"><info><title>Markup By Example</title></info> 10301debfc3dSmrg 10311debfc3dSmrg 10321debfc3dSmrg <para> 10331debfc3dSmrg Complete details on Docbook markup can be found in the 1034a2dc1f3fSmrg <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://tdg.docbook.org/tdg/5.0/ref-elements.html">DocBook Element Reference</link>. 10351debfc3dSmrg An incomplete reference for HTML to Docbook conversion is 10361debfc3dSmrg detailed in the table below. 10371debfc3dSmrg </para> 10381debfc3dSmrg 10391debfc3dSmrg<table frame="all" xml:id="table.docbook_cmp"> 10401debfc3dSmrg<title>HTML to Docbook XML Markup Comparison</title> 10411debfc3dSmrg 10421debfc3dSmrg<tgroup cols="2" align="left" colsep="1" rowsep="1"> 10431debfc3dSmrg<colspec colname="c1"/> 10441debfc3dSmrg<colspec colname="c2"/> 10451debfc3dSmrg 10461debfc3dSmrg <thead> 10471debfc3dSmrg <row> 10481debfc3dSmrg <entry>HTML</entry> 10491debfc3dSmrg <entry>Docbook</entry> 10501debfc3dSmrg </row> 10511debfc3dSmrg </thead> 10521debfc3dSmrg 10531debfc3dSmrg <tbody> 10541debfc3dSmrg <row> 10551debfc3dSmrg <entry><p></entry> 10561debfc3dSmrg <entry><para></entry> 10571debfc3dSmrg </row> 10581debfc3dSmrg <row> 10591debfc3dSmrg <entry><pre></entry> 10601debfc3dSmrg <entry><computeroutput>, <programlisting>, 10611debfc3dSmrg <literallayout></entry> 10621debfc3dSmrg </row> 10631debfc3dSmrg <row> 10641debfc3dSmrg <entry><ul></entry> 10651debfc3dSmrg <entry><itemizedlist></entry> 10661debfc3dSmrg </row> 10671debfc3dSmrg <row> 10681debfc3dSmrg <entry><ol></entry> 10691debfc3dSmrg <entry><orderedlist></entry> 10701debfc3dSmrg </row> 10711debfc3dSmrg <row> 10721debfc3dSmrg <entry><il></entry> 10731debfc3dSmrg <entry><listitem></entry> 10741debfc3dSmrg </row> 10751debfc3dSmrg <row> 10761debfc3dSmrg <entry><dl></entry> 10771debfc3dSmrg <entry><variablelist></entry> 10781debfc3dSmrg </row> 10791debfc3dSmrg <row> 10801debfc3dSmrg <entry><dt></entry> 10811debfc3dSmrg <entry><term></entry> 10821debfc3dSmrg </row> 10831debfc3dSmrg <row> 10841debfc3dSmrg <entry><dd></entry> 10851debfc3dSmrg <entry><listitem></entry> 10861debfc3dSmrg </row> 10871debfc3dSmrg 10881debfc3dSmrg <row> 10891debfc3dSmrg <entry><a href=""></entry> 10901debfc3dSmrg <entry><ulink url=""></entry> 10911debfc3dSmrg </row> 10921debfc3dSmrg <row> 10931debfc3dSmrg <entry><code></entry> 10941debfc3dSmrg <entry><literal>, <programlisting></entry> 10951debfc3dSmrg </row> 10961debfc3dSmrg <row> 10971debfc3dSmrg <entry><strong></entry> 10981debfc3dSmrg <entry><emphasis></entry> 10991debfc3dSmrg </row> 11001debfc3dSmrg <row> 11011debfc3dSmrg <entry><em></entry> 11021debfc3dSmrg <entry><emphasis></entry> 11031debfc3dSmrg </row> 11041debfc3dSmrg <row> 11051debfc3dSmrg <entry>"</entry> 11061debfc3dSmrg <entry><quote></entry> 11071debfc3dSmrg </row> 11081debfc3dSmrg </tbody> 11091debfc3dSmrg</tgroup> 11101debfc3dSmrg</table> 11111debfc3dSmrg 11121debfc3dSmrg<para> 11131debfc3dSmrg And examples of detailed markup for which there are no real HTML 11141debfc3dSmrg equivalents are listed in the table below. 11151debfc3dSmrg</para> 11161debfc3dSmrg 11171debfc3dSmrg<table frame="all" xml:id="table.docbook_elem"> 11181debfc3dSmrg<title>Docbook XML Element Use</title> 11191debfc3dSmrg 11201debfc3dSmrg<tgroup cols="2" align="left" colsep="1" rowsep="1"> 11211debfc3dSmrg<colspec colname="c1"/> 11221debfc3dSmrg<colspec colname="c2"/> 11231debfc3dSmrg 11241debfc3dSmrg <thead> 11251debfc3dSmrg <row> 11261debfc3dSmrg <entry>Element</entry> 11271debfc3dSmrg <entry>Use</entry> 11281debfc3dSmrg </row> 11291debfc3dSmrg </thead> 11301debfc3dSmrg 11311debfc3dSmrg <tbody> 11321debfc3dSmrg <row> 11331debfc3dSmrg <entry><structname></entry> 11341debfc3dSmrg <entry><structname>char_traits</structname></entry> 11351debfc3dSmrg </row> 11361debfc3dSmrg <row> 11371debfc3dSmrg <entry><classname></entry> 11381debfc3dSmrg <entry><classname>string</classname></entry> 11391debfc3dSmrg </row> 11401debfc3dSmrg <row> 11411debfc3dSmrg <entry><function></entry> 11421debfc3dSmrg <entry> 11431debfc3dSmrg <para><function>clear()</function></para> 11441debfc3dSmrg <para><function>fs.clear()</function></para> 11451debfc3dSmrg </entry> 11461debfc3dSmrg </row> 11471debfc3dSmrg <row> 11481debfc3dSmrg <entry><type></entry> 11491debfc3dSmrg <entry><type>long long</type></entry> 11501debfc3dSmrg </row> 11511debfc3dSmrg <row> 11521debfc3dSmrg <entry><varname></entry> 11531debfc3dSmrg <entry><varname>fs</varname></entry> 11541debfc3dSmrg </row> 11551debfc3dSmrg <row> 11561debfc3dSmrg <entry><literal></entry> 11571debfc3dSmrg <entry> 11581debfc3dSmrg <para><literal>-Weffc++</literal></para> 11591debfc3dSmrg <para><literal>rel_ops</literal></para> 11601debfc3dSmrg </entry> 11611debfc3dSmrg </row> 11621debfc3dSmrg <row> 11631debfc3dSmrg <entry><constant></entry> 11641debfc3dSmrg <entry> 11651debfc3dSmrg <para><constant>_GNU_SOURCE</constant></para> 11661debfc3dSmrg <para><constant>3.0</constant></para> 11671debfc3dSmrg </entry> 11681debfc3dSmrg </row> 11691debfc3dSmrg <row> 11701debfc3dSmrg <entry><command></entry> 11711debfc3dSmrg <entry><command>g++</command></entry> 11721debfc3dSmrg </row> 11731debfc3dSmrg <row> 11741debfc3dSmrg <entry><errortext></entry> 11751debfc3dSmrg <entry><errortext>In instantiation of</errortext></entry> 11761debfc3dSmrg </row> 11771debfc3dSmrg <row> 11781debfc3dSmrg <entry><filename></entry> 11791debfc3dSmrg <entry> 11801debfc3dSmrg <para><filename class="headerfile">ctype.h</filename></para> 11811debfc3dSmrg <para><filename class="directory">/home/gcc/build</filename></para> 11821debfc3dSmrg <para><filename class="libraryfile">libstdc++.so</filename></para> 11831debfc3dSmrg </entry> 11841debfc3dSmrg </row> 11851debfc3dSmrg </tbody> 11861debfc3dSmrg</tgroup> 11871debfc3dSmrg</table> 11881debfc3dSmrg 11891debfc3dSmrg</section> 11901debfc3dSmrg</section> 11911debfc3dSmrg</section> 1192