148fb7bfaSmrg<section xmlns="http://docbook.org/ns/docbook" version="5.0" 248fb7bfaSmrg xml:id="appendix.porting.doc" xreflabel="Documentation Hacking"> 348fb7bfaSmrg<?dbhtml filename="documentation_hacking.html"?> 448fb7bfaSmrg 548fb7bfaSmrg<info><title>Writing and Generating Documentation</title> 648fb7bfaSmrg <keywordset> 748fb7bfaSmrg <keyword>ISO C++</keyword> 848fb7bfaSmrg <keyword>documentation</keyword> 948fb7bfaSmrg <keyword>style</keyword> 1048fb7bfaSmrg <keyword>docbook</keyword> 1148fb7bfaSmrg <keyword>doxygen</keyword> 1248fb7bfaSmrg </keywordset> 1348fb7bfaSmrg</info> 1448fb7bfaSmrg 1548fb7bfaSmrg <section xml:id="doc.intro"> 1648fb7bfaSmrg <info> 1748fb7bfaSmrg <title>Introduction</title> 1848fb7bfaSmrg </info> 1948fb7bfaSmrg <para> 2048fb7bfaSmrg Documentation for the GNU C++ Library is created from three 2148fb7bfaSmrg independent sources: a manual, a FAQ, and an API reference. 2248fb7bfaSmrg </para> 2348fb7bfaSmrg <para> 2448fb7bfaSmrg The sub-directory <filename class="directory">doc</filename> 2548fb7bfaSmrg within the main source directory contains 2648fb7bfaSmrg <filename>Makefile.am</filename> and 2748fb7bfaSmrg <filename>Makefile.in</filename>, which provide rules for 2848fb7bfaSmrg generating documentation, described in excruciating detail 2948fb7bfaSmrg below. The <filename class="directory">doc</filename> 3048fb7bfaSmrg sub-directory also contains three directories: <filename 3148fb7bfaSmrg class="directory">doxygen</filename>, which contains scripts and 3248fb7bfaSmrg fragments for <command>doxygen</command>, <filename 3348fb7bfaSmrg class="directory">html</filename>, which contains an html 3448fb7bfaSmrg version of the manual, and <filename 3548fb7bfaSmrg class="directory">xml</filename>, which contains an xml version 3648fb7bfaSmrg of the manual. 3748fb7bfaSmrg </para> 3848fb7bfaSmrg <para> 3948fb7bfaSmrg Diverging from established documentation conventions in the rest 4048fb7bfaSmrg of the GCC project, libstdc++ does not use Texinfo as a markup 4148fb7bfaSmrg language. Instead, Docbook is used to create the manual and the 4248fb7bfaSmrg FAQ, and Doxygen is used to construct the API 4348fb7bfaSmrg reference. Although divergent, this conforms to the GNU Project 4448fb7bfaSmrg recommendations as long as the output is of sufficient quality, 4548fb7bfaSmrg as per 4648fb7bfaSmrg <link xmlns:xlink="http://www.w3.org/1999/xlink" 4748fb7bfaSmrg xlink:href="http://www.gnu.org/prep/standards/standards.html#Documentation"> 4848fb7bfaSmrg GNU Manuals</link>. 4948fb7bfaSmrg </para> 5048fb7bfaSmrg </section> 5148fb7bfaSmrg 5248fb7bfaSmrg <section xml:id="doc.generation"> 5348fb7bfaSmrg <info> 5448fb7bfaSmrg <title>Generating Documentation</title> 5548fb7bfaSmrg </info> 5648fb7bfaSmrg 5748fb7bfaSmrg <para> 5848fb7bfaSmrg Certain Makefile rules are required by the GNU Coding 5948fb7bfaSmrg Standards. These standard rules generate HTML, PDF, XML, or man 6048fb7bfaSmrg files. For each of the generative rules, there is an additional 6148fb7bfaSmrg install rule that is used to install any generated documentation 6248fb7bfaSmrg files into the prescribed installation directory. Files are 6348fb7bfaSmrg installed into <filename class="directory">share/doc</filename> 6448fb7bfaSmrg or <filename class="directory">share/man</filename> directories. 6548fb7bfaSmrg </para> 6648fb7bfaSmrg 6748fb7bfaSmrg <para> 6848fb7bfaSmrg The standard Makefile rules are conditionally supported, based 6948fb7bfaSmrg on the results of examining the host environment for 7048fb7bfaSmrg prerequisites at configuration time. If requirements are not 7148fb7bfaSmrg found, the rule is aliased to a dummy rule that does nothing, 7248fb7bfaSmrg and produces no documentation. If the requirements are found, 7348fb7bfaSmrg the rule forwards to a private rule that produces the requested 7448fb7bfaSmrg documentation. 7548fb7bfaSmrg </para> 7648fb7bfaSmrg 7748fb7bfaSmrg <para> 7848fb7bfaSmrg For more details on what prerequisites were found and where, 7948fb7bfaSmrg please consult the file <filename>config.log</filename> in the 8048fb7bfaSmrg libstdc++ build directory. Compare this log to what is expected 8148fb7bfaSmrg for the relevant Makefile conditionals: 8248fb7bfaSmrg <literal>BUILD_INFO</literal>, <literal>BUILD_XML</literal>, 8348fb7bfaSmrg <literal>BUILD_HTML</literal>, <literal>BUILD_MAN</literal>, 8448fb7bfaSmrg <literal>BUILD_PDF</literal>, and <literal>BUILD_EPUB</literal>. 8548fb7bfaSmrg </para> 8648fb7bfaSmrg 8748fb7bfaSmrg <para> 8848fb7bfaSmrg Supported Makefile rules: 8948fb7bfaSmrg </para> 9048fb7bfaSmrg 9148fb7bfaSmrg <variablelist> 9248fb7bfaSmrg <varlistentry> 9348fb7bfaSmrg <term> 9448fb7bfaSmrg <emphasis>make html</emphasis> 9548fb7bfaSmrg </term> 9648fb7bfaSmrg <term> 9748fb7bfaSmrg <emphasis>make install-html</emphasis> 9848fb7bfaSmrg </term> 9948fb7bfaSmrg <listitem> 10048fb7bfaSmrg <para> 10148fb7bfaSmrg Generates multi-page HTML documentation, and installs it 10248fb7bfaSmrg in the following directories: 10348fb7bfaSmrg </para> 10448fb7bfaSmrg <para> 10548fb7bfaSmrg <filename>doc/libstdc++/libstdc++-api.html</filename> 10648fb7bfaSmrg </para> 10748fb7bfaSmrg <para> 10848fb7bfaSmrg <filename>doc/libstdc++/libstdc++-manual.html</filename> 10948fb7bfaSmrg </para> 11048fb7bfaSmrg </listitem> 11148fb7bfaSmrg </varlistentry> 11248fb7bfaSmrg 11348fb7bfaSmrg <varlistentry> 11448fb7bfaSmrg <term> 11548fb7bfaSmrg <emphasis>make pdf</emphasis> 11648fb7bfaSmrg </term> 11748fb7bfaSmrg <term> 11848fb7bfaSmrg <emphasis>make install-pdf</emphasis> 11948fb7bfaSmrg </term> 12048fb7bfaSmrg <listitem> 12148fb7bfaSmrg <para> 12248fb7bfaSmrg Generates indexed PDF documentation, and installs it as 12348fb7bfaSmrg the following files: 12448fb7bfaSmrg </para> 12548fb7bfaSmrg <para> 12648fb7bfaSmrg <filename>doc/libstdc++/libstdc++-api.pdf</filename> 12748fb7bfaSmrg </para> 12848fb7bfaSmrg <para> 12948fb7bfaSmrg <filename>doc/libstdc++/libstdc++-manual.pdf</filename> 13048fb7bfaSmrg </para> 13148fb7bfaSmrg </listitem> 13248fb7bfaSmrg </varlistentry> 13348fb7bfaSmrg 13448fb7bfaSmrg <varlistentry> 13548fb7bfaSmrg <term> 13648fb7bfaSmrg <emphasis>make man</emphasis> 13748fb7bfaSmrg </term> 13848fb7bfaSmrg <term> 13948fb7bfaSmrg <emphasis>make install-man</emphasis> 14048fb7bfaSmrg </term> 14148fb7bfaSmrg <listitem> 14248fb7bfaSmrg <para> 14348fb7bfaSmrg Generates man pages, and installs it in the following directory: 14448fb7bfaSmrg </para> 14548fb7bfaSmrg <para> 14648fb7bfaSmrg <filename class="directory">man/man3/</filename> 14748fb7bfaSmrg </para> 14848fb7bfaSmrg <para> 14948fb7bfaSmrg The generated man pages are namespace-qualified, so to look at 15048fb7bfaSmrg the man page for <classname>vector</classname>, one would use 15148fb7bfaSmrg <command>man std::vector</command>. 15248fb7bfaSmrg </para> 15348fb7bfaSmrg </listitem> 15448fb7bfaSmrg </varlistentry> 15548fb7bfaSmrg 15648fb7bfaSmrg <varlistentry> 15748fb7bfaSmrg <term> 15848fb7bfaSmrg <emphasis>make epub</emphasis> 15948fb7bfaSmrg </term> 16048fb7bfaSmrg <term> 16148fb7bfaSmrg <emphasis>make install-epub</emphasis> 16248fb7bfaSmrg </term> 16348fb7bfaSmrg <listitem> 16448fb7bfaSmrg <para> 16548fb7bfaSmrg Generates documentation in the ebook/portable electronic 16648fb7bfaSmrg reader format called Epub, and installs it as the 16748fb7bfaSmrg following file. 16848fb7bfaSmrg </para> 16948fb7bfaSmrg <para> 17048fb7bfaSmrg <filename>doc/libstdc++/libstdc++-manual.epub</filename> 17148fb7bfaSmrg </para> 17248fb7bfaSmrg </listitem> 17348fb7bfaSmrg </varlistentry> 17448fb7bfaSmrg 17548fb7bfaSmrg <varlistentry> 17648fb7bfaSmrg <term> 17748fb7bfaSmrg <emphasis>make xml</emphasis> 17848fb7bfaSmrg </term> 17948fb7bfaSmrg <term> 18048fb7bfaSmrg <emphasis>make install-xml</emphasis> 18148fb7bfaSmrg </term> 18248fb7bfaSmrg <listitem> 18348fb7bfaSmrg <para> 18448fb7bfaSmrg Generates single-file XML documentation, and installs it 18548fb7bfaSmrg as the following files: 18648fb7bfaSmrg </para> 18748fb7bfaSmrg <para> 18848fb7bfaSmrg <filename>doc/libstdc++/libstdc++-api-single.xml</filename> 18948fb7bfaSmrg </para> 19048fb7bfaSmrg <para> 19148fb7bfaSmrg <filename>doc/libstdc++/libstdc++-manual-single.xml</filename> 19248fb7bfaSmrg </para> 19348fb7bfaSmrg </listitem> 19448fb7bfaSmrg </varlistentry> 19548fb7bfaSmrg </variablelist> 19648fb7bfaSmrg 19748fb7bfaSmrg <para> 19848fb7bfaSmrg Makefile rules for several other formats are explicitly not 19948fb7bfaSmrg supported, and are always aliased to dummy rules. These 20048fb7bfaSmrg unsupported formats are: <emphasis>info</emphasis>, 20148fb7bfaSmrg <emphasis>ps</emphasis>, and <emphasis>dvi</emphasis>. 20248fb7bfaSmrg </para> 20348fb7bfaSmrg </section> 20448fb7bfaSmrg 20548fb7bfaSmrg <section xml:id="doc.doxygen"><info><title>Doxygen</title></info> 20648fb7bfaSmrg 20748fb7bfaSmrg <section xml:id="doxygen.prereq"><info><title>Prerequisites</title></info> 20848fb7bfaSmrg 2094d5abbe8Smrg <table frame="all" xml:id="table.doxygen_prereq"> 21048fb7bfaSmrg<title>Doxygen Prerequisites</title> 21148fb7bfaSmrg 21248fb7bfaSmrg<tgroup cols="3" align="center" colsep="1" rowsep="1"> 21348fb7bfaSmrg<colspec colname="c1"/> 21448fb7bfaSmrg<colspec colname="c2"/> 21548fb7bfaSmrg<colspec colname="c3"/> 21648fb7bfaSmrg 21748fb7bfaSmrg <thead> 21848fb7bfaSmrg <row> 21948fb7bfaSmrg <entry>Tool</entry> 22048fb7bfaSmrg <entry>Version</entry> 22148fb7bfaSmrg <entry>Required By</entry> 22248fb7bfaSmrg </row> 22348fb7bfaSmrg </thead> 22448fb7bfaSmrg 22548fb7bfaSmrg <tbody> 22648fb7bfaSmrg 22748fb7bfaSmrg <row> 22848fb7bfaSmrg <entry>coreutils</entry> 22948fb7bfaSmrg <entry>8.5</entry> 23048fb7bfaSmrg <entry>all</entry> 23148fb7bfaSmrg </row> 23248fb7bfaSmrg 23348fb7bfaSmrg <row> 23448fb7bfaSmrg <entry>bash</entry> 23548fb7bfaSmrg <entry>4.1</entry> 23648fb7bfaSmrg <entry>all</entry> 23748fb7bfaSmrg </row> 23848fb7bfaSmrg 23948fb7bfaSmrg <row> 24048fb7bfaSmrg <entry>doxygen</entry> 24148fb7bfaSmrg <entry>1.7.6.1</entry> 24248fb7bfaSmrg <entry>all</entry> 24348fb7bfaSmrg </row> 24448fb7bfaSmrg 24548fb7bfaSmrg <row> 24648fb7bfaSmrg <entry>graphviz</entry> 24748fb7bfaSmrg <entry>2.26</entry> 24848fb7bfaSmrg <entry>graphical hierarchies</entry> 24948fb7bfaSmrg </row> 25048fb7bfaSmrg 25148fb7bfaSmrg <row> 25248fb7bfaSmrg <entry>pdflatex</entry> 25348fb7bfaSmrg <entry>2007-59</entry> 25448fb7bfaSmrg <entry>pdf output</entry> 25548fb7bfaSmrg </row> 25648fb7bfaSmrg 25748fb7bfaSmrg </tbody> 25848fb7bfaSmrg</tgroup> 25948fb7bfaSmrg</table> 26048fb7bfaSmrg 26148fb7bfaSmrg 26248fb7bfaSmrg <para> 26348fb7bfaSmrg Prerequisite tools are Bash 2.0 or later, 264*b1e83836Smrg <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.doxygen.nl">Doxygen</link>, and 26548fb7bfaSmrg the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.gnu.org/software/coreutils/">GNU 26648fb7bfaSmrg coreutils</link>. (GNU versions of find, xargs, and possibly 26748fb7bfaSmrg sed and grep are used, just because the GNU versions make 26848fb7bfaSmrg things very easy.) 26948fb7bfaSmrg </para> 27048fb7bfaSmrg 27148fb7bfaSmrg <para> 27248fb7bfaSmrg To generate the pretty pictures and hierarchy 27348fb7bfaSmrg graphs, the 27448fb7bfaSmrg <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.graphviz.org">Graphviz</link> package 27548fb7bfaSmrg will need to be installed. For PDF 27648fb7bfaSmrg output, <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.tug.org/applications/pdftex/"> 2774d5abbe8Smrg pdflatex</link> is required as well as a number of TeX packages 2784d5abbe8Smrg such as <package>texlive-xtab</package> and 2794d5abbe8Smrg <package>texlive-tocloft</package>. 28048fb7bfaSmrg </para> 28148fb7bfaSmrg 28248fb7bfaSmrg <para> 28348fb7bfaSmrg Be warned the PDF file generated via doxygen is extremely 28448fb7bfaSmrg large. At last count, the PDF file is over three thousand 28548fb7bfaSmrg pages. Generating this document taxes the underlying TeX 28648fb7bfaSmrg formatting system, and will require the expansion of TeX's memory 28748fb7bfaSmrg capacity. Specifically, the <literal>pool_size</literal> 28848fb7bfaSmrg variable in the configuration file <filename>texmf.cnf</filename> may 28948fb7bfaSmrg need to be increased by a minimum factor of two. 29048fb7bfaSmrg </para> 29148fb7bfaSmrg </section> 29248fb7bfaSmrg 29348fb7bfaSmrg <section xml:id="doxygen.rules"><info><title>Generating the Doxygen Files</title></info> 29448fb7bfaSmrg 29548fb7bfaSmrg <para> 29648fb7bfaSmrg The following Makefile rules run Doxygen to generate HTML 29748fb7bfaSmrg docs, XML docs, XML docs as a single file, PDF docs, and the 29848fb7bfaSmrg man pages. These rules are not conditional! If the required 29948fb7bfaSmrg tools are not found, or are the wrong versions, the rule may 30048fb7bfaSmrg end in an error. 30148fb7bfaSmrg </para> 30248fb7bfaSmrg 30348fb7bfaSmrg <para> 30448fb7bfaSmrg <screen><userinput>make doc-html-doxygen</userinput></screen> 30548fb7bfaSmrg </para> 30648fb7bfaSmrg 30748fb7bfaSmrg <para> 30848fb7bfaSmrg <screen><userinput>make doc-xml-doxygen</userinput></screen> 30948fb7bfaSmrg </para> 31048fb7bfaSmrg 31148fb7bfaSmrg <para> 31248fb7bfaSmrg <screen><userinput>make doc-xml-single-doxygen</userinput></screen> 31348fb7bfaSmrg </para> 31448fb7bfaSmrg 31548fb7bfaSmrg <para> 31648fb7bfaSmrg <screen><userinput>make doc-pdf-doxygen</userinput></screen> 31748fb7bfaSmrg </para> 31848fb7bfaSmrg 31948fb7bfaSmrg <para> 32048fb7bfaSmrg <screen><userinput>make doc-man-doxygen</userinput></screen> 32148fb7bfaSmrg </para> 32248fb7bfaSmrg 32348fb7bfaSmrg <para> 32448fb7bfaSmrg Generated files are output into separate sub directories of 32548fb7bfaSmrg <filename class="directory">doc/doxygen/</filename> in the 32648fb7bfaSmrg build directory, based on the output format. For instance, the 32748fb7bfaSmrg HTML docs will be in <filename class="directory">doc/doxygen/html</filename>. 32848fb7bfaSmrg </para> 32948fb7bfaSmrg 33048fb7bfaSmrg <para> 33148fb7bfaSmrg Careful observers will see that the Makefile rules simply call 33248fb7bfaSmrg a script from the source tree, <filename>run_doxygen</filename>, which 33348fb7bfaSmrg does the actual work of running Doxygen and then (most 33448fb7bfaSmrg importantly) massaging the output files. If for some reason 33548fb7bfaSmrg you prefer to not go through the Makefile, you can call this 33648fb7bfaSmrg script directly. (Start by passing <literal>--help</literal>.) 33748fb7bfaSmrg </para> 33848fb7bfaSmrg 33948fb7bfaSmrg <para> 34048fb7bfaSmrg If you wish to tweak the Doxygen settings, do so by editing 34148fb7bfaSmrg <filename>doc/doxygen/user.cfg.in</filename>. Notes to fellow 34248fb7bfaSmrg library hackers are written in triple-# comments. 34348fb7bfaSmrg </para> 34448fb7bfaSmrg 34548fb7bfaSmrg </section> 34648fb7bfaSmrg 34748fb7bfaSmrg <section xml:id="doxygen.debug"> 34848fb7bfaSmrg <info><title>Debugging Generation</title></info> 34948fb7bfaSmrg 35048fb7bfaSmrg <para> 35148fb7bfaSmrg Sometimes, mis-configuration of the pre-requisite tools can 35248fb7bfaSmrg lead to errors when attempting to build the 35348fb7bfaSmrg documentation. Here are some of the obvious errors, and ways 35448fb7bfaSmrg to fix some common issues that may appear quite cryptic. 35548fb7bfaSmrg </para> 35648fb7bfaSmrg 35748fb7bfaSmrg <para> 35848fb7bfaSmrg First, if using a rule like <code>make pdf</code>, try to 35948fb7bfaSmrg narrow down the scope of the error to either docbook 36048fb7bfaSmrg (<code>make doc-pdf-docbook</code>) or doxygen (<code>make 36148fb7bfaSmrg doc-pdf-doxygen</code>). 36248fb7bfaSmrg </para> 36348fb7bfaSmrg <para> 36448fb7bfaSmrg Working on the doxygen path only, closely examine the 3654d5abbe8Smrg contents of the following build directory: <filename 3664d5abbe8Smrg class="directory">build/target/libstdc++-v3/doc/doxygen/latex</filename>. 36748fb7bfaSmrg Pay attention to three files enclosed within, annotated as follows. 36848fb7bfaSmrg </para> 36948fb7bfaSmrg<itemizedlist> 37048fb7bfaSmrg 37148fb7bfaSmrg<listitem> 37248fb7bfaSmrg <para> 37348fb7bfaSmrg <emphasis>refman.tex</emphasis> 37448fb7bfaSmrg </para> 37548fb7bfaSmrg 37648fb7bfaSmrg <para> 37748fb7bfaSmrg The actual latex file, or partial latex file. This is generated 37848fb7bfaSmrg via <command>doxygen</command>, and is the LaTeX version of the 37948fb7bfaSmrg Doxygen XML file <filename>libstdc++-api.xml</filename>. Go to a specific 3804d5abbe8Smrg line, and look at the generated LaTeX, and try to deduce what 38148fb7bfaSmrg markup in <filename>libstdc++-api.xml</filename> is causing it. 38248fb7bfaSmrg </para> 38348fb7bfaSmrg</listitem> 38448fb7bfaSmrg 38548fb7bfaSmrg<listitem> 38648fb7bfaSmrg <para> 3874d5abbe8Smrg <emphasis>refman.log</emphasis> 3884d5abbe8Smrg </para> 3894d5abbe8Smrg 3904d5abbe8Smrg <para> 3914d5abbe8Smrg A log created by <command>latex</command> as it processes the 3924d5abbe8Smrg <filename>refman.tex</filename> file. If generating the PDF fails 3934d5abbe8Smrg look at the end of this file for errors such as: 3944d5abbe8Smrg <screen> 3954d5abbe8Smrg ! LaTeX Error: File `xtab.sty' not found. 3964d5abbe8Smrg </screen> 3974d5abbe8Smrg This indicates a required TeX package is missing. For the example 3984d5abbe8Smrg above the <package>texlive-xtab</package> package needs to be 3994d5abbe8Smrg installed. 4004d5abbe8Smrg </para> 4014d5abbe8Smrg</listitem> 4024d5abbe8Smrg 4034d5abbe8Smrg<listitem> 4044d5abbe8Smrg <para> 40548fb7bfaSmrg <emphasis>refman.out</emphasis> 40648fb7bfaSmrg </para> 40748fb7bfaSmrg 40848fb7bfaSmrg <para> 4094d5abbe8Smrg A log of the compilation of the converted LaTeX form to PDF. This 41048fb7bfaSmrg is a linear list, from the beginning of the 41148fb7bfaSmrg <filename>refman.tex</filename> file: the last entry of this file 41248fb7bfaSmrg should be the end of the LaTeX file. If it is truncated, then you 41348fb7bfaSmrg know that the last entry is the last part of the generated LaTeX 41448fb7bfaSmrg source file that is valid. Often this file contains an error with 41548fb7bfaSmrg a specific line number of <filename>refman.tex</filename> that is 41648fb7bfaSmrg incorrect, or will have clues at the end of the file with the dump 41748fb7bfaSmrg of the memory usage of LaTeX. 41848fb7bfaSmrg </para> 41948fb7bfaSmrg</listitem> 42048fb7bfaSmrg</itemizedlist> 42148fb7bfaSmrg 42248fb7bfaSmrg <para> 42348fb7bfaSmrg If the error at hand is not obvious after examination, a 42448fb7bfaSmrg fall-back strategy is to start commenting out the doxygen 42548fb7bfaSmrg input sources, which can be found in 42648fb7bfaSmrg <filename>doc/doxygen/user.cfg.in</filename>, look for the 42748fb7bfaSmrg <literal>INPUT</literal> tag. Start by commenting out whole 42848fb7bfaSmrg directories of header files, until the offending header is 42948fb7bfaSmrg identified. Then, read the latex log files to try and find 43048fb7bfaSmrg surround text, and look for that in the offending header. 43148fb7bfaSmrg </para> 43248fb7bfaSmrg 43348fb7bfaSmrg </section> 43448fb7bfaSmrg 43548fb7bfaSmrg <section xml:id="doxygen.markup"><info><title>Markup</title></info> 43648fb7bfaSmrg 43748fb7bfaSmrg 43848fb7bfaSmrg <para> 43948fb7bfaSmrg In general, libstdc++ files should be formatted according to 44048fb7bfaSmrg the rules found in the 44148fb7bfaSmrg <link linkend="contrib.coding_style">Coding Standard</link>. Before 44248fb7bfaSmrg any doxygen-specific formatting tweaks are made, please try to 44348fb7bfaSmrg make sure that the initial formatting is sound. 44448fb7bfaSmrg </para> 44548fb7bfaSmrg 44648fb7bfaSmrg <para> 44748fb7bfaSmrg Adding Doxygen markup to a file (informally called 448fb8a8121Smrg <quote>doxygenating</quote>) is very simple. See the 449fb8a8121Smrg <link xmlns:xlink="http://www.w3.org/1999/xlink" 450*b1e83836Smrg xlink:href="https://www.doxygen.nl/download.html#latestman">Doxygen 451fb8a8121Smrg manual</link> for details. 45248fb7bfaSmrg We try to use a very-recent version of Doxygen. 45348fb7bfaSmrg </para> 45448fb7bfaSmrg 45548fb7bfaSmrg <para> 45648fb7bfaSmrg For classes, use 45748fb7bfaSmrg <classname>deque</classname>/<classname>vector</classname>/<classname>list</classname> 45848fb7bfaSmrg and <classname>std::pair</classname> as examples. For 45948fb7bfaSmrg functions, see their member functions, and the free functions 4604d5abbe8Smrg in <filename class="headerfile">stl_algobase.h</filename>. Member 4614d5abbe8Smrg functions of other container-like types should read similarly to 4624d5abbe8Smrg these member functions. 46348fb7bfaSmrg </para> 46448fb7bfaSmrg 46548fb7bfaSmrg <para> 46648fb7bfaSmrg Some commentary to accompany 467fb8a8121Smrg the first list in the <link xmlns:xlink="http://www.w3.org/1999/xlink" 468*b1e83836Smrg xlink:href="https://www.doxygen.nl/manual/docblocks.html">Special 46948fb7bfaSmrg Documentation Blocks</link> section of the Doxygen manual: 47048fb7bfaSmrg </para> 47148fb7bfaSmrg 47248fb7bfaSmrg <orderedlist inheritnum="ignore" continuation="restarts"> 47348fb7bfaSmrg <listitem> 47448fb7bfaSmrg <para>For longer comments, use the Javadoc style...</para> 47548fb7bfaSmrg </listitem> 47648fb7bfaSmrg 47748fb7bfaSmrg <listitem> 47848fb7bfaSmrg <para> 47948fb7bfaSmrg ...not the Qt style. The intermediate *'s are preferred. 48048fb7bfaSmrg </para> 48148fb7bfaSmrg </listitem> 48248fb7bfaSmrg 48348fb7bfaSmrg <listitem> 48448fb7bfaSmrg <para> 48548fb7bfaSmrg Use the triple-slash style only for one-line comments (the 48648fb7bfaSmrg <quote>brief</quote> mode). 48748fb7bfaSmrg </para> 48848fb7bfaSmrg </listitem> 48948fb7bfaSmrg 49048fb7bfaSmrg <listitem> 49148fb7bfaSmrg <para> 49248fb7bfaSmrg This is disgusting. Don't do this. 49348fb7bfaSmrg </para> 49448fb7bfaSmrg </listitem> 49548fb7bfaSmrg </orderedlist> 49648fb7bfaSmrg 49748fb7bfaSmrg <para> 49848fb7bfaSmrg Some specific guidelines: 49948fb7bfaSmrg </para> 50048fb7bfaSmrg 50148fb7bfaSmrg <para> 50248fb7bfaSmrg Use the @-style of commands, not the !-style. Please be 50348fb7bfaSmrg careful about whitespace in your markup comments. Most of the 50448fb7bfaSmrg time it doesn't matter; doxygen absorbs most whitespace, and 50548fb7bfaSmrg both HTML and *roff are agnostic about whitespace. However, 50648fb7bfaSmrg in <pre> blocks and @code/@endcode sections, spacing can 50748fb7bfaSmrg have <quote>interesting</quote> effects. 50848fb7bfaSmrg </para> 50948fb7bfaSmrg 51048fb7bfaSmrg <para> 51148fb7bfaSmrg Use either kind of grouping, as 51248fb7bfaSmrg appropriate. <filename>doxygroups.cc</filename> exists for this 5134d5abbe8Smrg purpose. See <filename class="headerfile">stl_iterator.h</filename> 5144d5abbe8Smrg for a good example of the <quote>other</quote> kind of grouping. 51548fb7bfaSmrg </para> 51648fb7bfaSmrg 51748fb7bfaSmrg <para> 51848fb7bfaSmrg Please use markup tags like @p and @a when referring to things 51948fb7bfaSmrg such as the names of function parameters. Use @e for emphasis 52048fb7bfaSmrg when necessary. Use @c to refer to other standard names. 52148fb7bfaSmrg (Examples of all these abound in the present code.) 52248fb7bfaSmrg </para> 52348fb7bfaSmrg 52448fb7bfaSmrg <para> 5254d5abbe8Smrg Complicated math functions should use the multi-line format. 5264d5abbe8Smrg An example from <filename class="headerfile">random.h</filename>: 52748fb7bfaSmrg </para> 52848fb7bfaSmrg 52948fb7bfaSmrg <para> 53048fb7bfaSmrg<literallayout class="normal"> 53148fb7bfaSmrg/** 53248fb7bfaSmrg * @brief A model of a linear congruential random number generator. 53348fb7bfaSmrg * 53448fb7bfaSmrg * @f[ 53548fb7bfaSmrg * x_{i+1}\leftarrow(ax_{i} + c) \bmod m 53648fb7bfaSmrg * @f] 53748fb7bfaSmrg */ 53848fb7bfaSmrg</literallayout> 53948fb7bfaSmrg </para> 54048fb7bfaSmrg 54148fb7bfaSmrg <para> 54248fb7bfaSmrg One area of note is the markup required for 54348fb7bfaSmrg <literal>@file</literal> markup in header files. Two details 54448fb7bfaSmrg are important: for filenames that have the same name in 54548fb7bfaSmrg multiple directories, include part of the installed path to 54648fb7bfaSmrg disambiguate. For example: 54748fb7bfaSmrg </para> 54848fb7bfaSmrg 54948fb7bfaSmrg <para> 55048fb7bfaSmrg<literallayout class="normal"> 55148fb7bfaSmrg/** @file debug/vector 55248fb7bfaSmrg * This file is a GNU debug extension to the Standard C++ Library. 55348fb7bfaSmrg */ 55448fb7bfaSmrg</literallayout> 55548fb7bfaSmrg </para> 55648fb7bfaSmrg 55748fb7bfaSmrg <para> 55848fb7bfaSmrg The other relevant detail for header files is the use of a 55948fb7bfaSmrg libstdc++-specific doxygen alias that helps distinguish 5604d5abbe8Smrg between public header files (like <filename class="headerfile">random</filename>) 56148fb7bfaSmrg from implementation or private header files (like 5624d5abbe8Smrg <filename class="headerfile">bits/c++config.h</filename>.) This alias is spelled 56348fb7bfaSmrg <literal>@headername</literal> and can take one or two 56448fb7bfaSmrg arguments that detail the public header file or files that 56548fb7bfaSmrg should be included to use the contents of the file. All header 56648fb7bfaSmrg files that are not intended for direct inclusion must use 56748fb7bfaSmrg <literal>headername</literal> in the <literal>file</literal> 56848fb7bfaSmrg block. An example: 56948fb7bfaSmrg </para> 57048fb7bfaSmrg 57148fb7bfaSmrg <para> 57248fb7bfaSmrg<literallayout class="normal"> 57348fb7bfaSmrg/** @file bits/basic_string.h 57448fb7bfaSmrg * This is an internal header file, included by other library headers. 57548fb7bfaSmrg * Do not attempt to use it directly. @headername{string} 57648fb7bfaSmrg */ 57748fb7bfaSmrg</literallayout> 57848fb7bfaSmrg </para> 57948fb7bfaSmrg 58048fb7bfaSmrg <para> 58148fb7bfaSmrg Be careful about using certain, special characters when 58248fb7bfaSmrg writing Doxygen comments. Single and double quotes, and 58348fb7bfaSmrg separators in filenames are two common trouble spots. When in 58448fb7bfaSmrg doubt, consult the following table. 58548fb7bfaSmrg </para> 58648fb7bfaSmrg 5874d5abbe8Smrg<table frame="all" xml:id="table.doxygen_cmp"> 58848fb7bfaSmrg<title>HTML to Doxygen Markup Comparison</title> 58948fb7bfaSmrg 59048fb7bfaSmrg<tgroup cols="2" align="left" colsep="1" rowsep="1"> 59148fb7bfaSmrg<colspec colname="c1"/> 59248fb7bfaSmrg<colspec colname="c2"/> 59348fb7bfaSmrg 59448fb7bfaSmrg <thead> 59548fb7bfaSmrg <row> 59648fb7bfaSmrg <entry>HTML</entry> 59748fb7bfaSmrg <entry>Doxygen</entry> 59848fb7bfaSmrg </row> 59948fb7bfaSmrg </thead> 60048fb7bfaSmrg 60148fb7bfaSmrg <tbody> 60248fb7bfaSmrg <row> 60348fb7bfaSmrg <entry>\</entry> 60448fb7bfaSmrg <entry>\\</entry> 60548fb7bfaSmrg </row> 60648fb7bfaSmrg 60748fb7bfaSmrg <row> 60848fb7bfaSmrg <entry>"</entry> 60948fb7bfaSmrg <entry>\"</entry> 61048fb7bfaSmrg </row> 61148fb7bfaSmrg 61248fb7bfaSmrg <row> 61348fb7bfaSmrg <entry>'</entry> 61448fb7bfaSmrg <entry>\'</entry> 61548fb7bfaSmrg </row> 61648fb7bfaSmrg 61748fb7bfaSmrg <row> 61848fb7bfaSmrg <entry><i></entry> 61948fb7bfaSmrg <entry>@a word</entry> 62048fb7bfaSmrg </row> 62148fb7bfaSmrg 62248fb7bfaSmrg <row> 62348fb7bfaSmrg <entry><b></entry> 62448fb7bfaSmrg <entry>@b word</entry> 62548fb7bfaSmrg </row> 62648fb7bfaSmrg 62748fb7bfaSmrg <row> 62848fb7bfaSmrg <entry><code></entry> 62948fb7bfaSmrg <entry>@c word</entry> 63048fb7bfaSmrg </row> 63148fb7bfaSmrg 63248fb7bfaSmrg <row> 63348fb7bfaSmrg <entry><em></entry> 63448fb7bfaSmrg <entry>@a word</entry> 63548fb7bfaSmrg </row> 63648fb7bfaSmrg 63748fb7bfaSmrg <row> 63848fb7bfaSmrg <entry><em></entry> 63948fb7bfaSmrg <entry><em>two words or more</em></entry> 64048fb7bfaSmrg </row> 64148fb7bfaSmrg </tbody> 64248fb7bfaSmrg 64348fb7bfaSmrg</tgroup> 64448fb7bfaSmrg</table> 64548fb7bfaSmrg 64648fb7bfaSmrg 64748fb7bfaSmrg </section> 64848fb7bfaSmrg 64948fb7bfaSmrg </section> 65048fb7bfaSmrg 65148fb7bfaSmrg <section xml:id="doc.docbook"><info><title>Docbook</title></info> 65248fb7bfaSmrg 65348fb7bfaSmrg 65448fb7bfaSmrg <section xml:id="docbook.prereq"><info><title>Prerequisites</title></info> 65548fb7bfaSmrg 65648fb7bfaSmrg 6574d5abbe8Smrg <table frame="all" xml:id="table.docbook_prereq"> 65848fb7bfaSmrg<title>Docbook Prerequisites</title> 65948fb7bfaSmrg 66048fb7bfaSmrg<tgroup cols="3" align="center" colsep="1" rowsep="1"> 66148fb7bfaSmrg<colspec colname="c1"/> 66248fb7bfaSmrg<colspec colname="c2"/> 66348fb7bfaSmrg<colspec colname="c3"/> 66448fb7bfaSmrg 66548fb7bfaSmrg <thead> 66648fb7bfaSmrg <row> 66748fb7bfaSmrg <entry>Tool</entry> 66848fb7bfaSmrg <entry>Version</entry> 66948fb7bfaSmrg <entry>Required By</entry> 67048fb7bfaSmrg </row> 67148fb7bfaSmrg </thead> 67248fb7bfaSmrg 67348fb7bfaSmrg <tbody> 67448fb7bfaSmrg 67548fb7bfaSmrg <row> 67648fb7bfaSmrg <entry>docbook5-style-xsl</entry> 67748fb7bfaSmrg <entry>1.76.1</entry> 67848fb7bfaSmrg <entry>all</entry> 67948fb7bfaSmrg </row> 68048fb7bfaSmrg 68148fb7bfaSmrg <row> 68248fb7bfaSmrg <entry>xsltproc</entry> 68348fb7bfaSmrg <entry>1.1.26</entry> 68448fb7bfaSmrg <entry>all</entry> 68548fb7bfaSmrg </row> 68648fb7bfaSmrg 68748fb7bfaSmrg <row> 68848fb7bfaSmrg <entry>xmllint</entry> 68948fb7bfaSmrg <entry>2.7.7</entry> 69048fb7bfaSmrg <entry>validation</entry> 69148fb7bfaSmrg </row> 69248fb7bfaSmrg 69348fb7bfaSmrg <row> 69448fb7bfaSmrg <entry>dblatex</entry> 69548fb7bfaSmrg <entry>0.3</entry> 69648fb7bfaSmrg <entry>pdf output</entry> 69748fb7bfaSmrg </row> 69848fb7bfaSmrg 69948fb7bfaSmrg <row> 70048fb7bfaSmrg <entry>pdflatex</entry> 70148fb7bfaSmrg <entry>2007-59</entry> 70248fb7bfaSmrg <entry>pdf output</entry> 70348fb7bfaSmrg </row> 70448fb7bfaSmrg 70548fb7bfaSmrg <row> 70648fb7bfaSmrg <entry>docbook2X</entry> 70748fb7bfaSmrg <entry>0.8.8</entry> 70848fb7bfaSmrg <entry>info output</entry> 70948fb7bfaSmrg </row> 71048fb7bfaSmrg 71148fb7bfaSmrg <row> 71248fb7bfaSmrg <entry>epub3 stylesheets</entry> 71348fb7bfaSmrg <entry>b3</entry> 71448fb7bfaSmrg <entry>epub output</entry> 71548fb7bfaSmrg </row> 71648fb7bfaSmrg 71748fb7bfaSmrg </tbody> 71848fb7bfaSmrg</tgroup> 71948fb7bfaSmrg</table> 72048fb7bfaSmrg 72148fb7bfaSmrg <para> 72248fb7bfaSmrg Editing the DocBook sources requires an XML editor. Many 72348fb7bfaSmrg exist: some notable options 72448fb7bfaSmrg include <command>emacs</command>, <application>Kate</application>, 72548fb7bfaSmrg or <application>Conglomerate</application>. 72648fb7bfaSmrg </para> 72748fb7bfaSmrg 72848fb7bfaSmrg <para> 72948fb7bfaSmrg Some editors support special <quote>XML Validation</quote> 73048fb7bfaSmrg modes that can validate the file as it is 73148fb7bfaSmrg produced. Recommended is the <command>nXML Mode</command> 73248fb7bfaSmrg for <command>emacs</command>. 73348fb7bfaSmrg </para> 73448fb7bfaSmrg 73548fb7bfaSmrg <para> 73648fb7bfaSmrg Besides an editor, additional DocBook files and XML tools are 73748fb7bfaSmrg also required. 73848fb7bfaSmrg </para> 73948fb7bfaSmrg 74048fb7bfaSmrg <para> 74148fb7bfaSmrg Access to the DocBook 5.0 stylesheets and schema is required. The 74248fb7bfaSmrg stylesheets are usually packaged by vendor, in something 74348fb7bfaSmrg like <filename>docbook5-style-xsl</filename>. To exactly match 74448fb7bfaSmrg generated output, please use a version of the stylesheets 74548fb7bfaSmrg equivalent 74648fb7bfaSmrg to <filename>docbook5-style-xsl-1.75.2-3</filename>. The 74748fb7bfaSmrg installation directory for this package corresponds to 74848fb7bfaSmrg the <literal>XSL_STYLE_DIR</literal> 74948fb7bfaSmrg in <filename>doc/Makefile.am</filename> and defaults 75048fb7bfaSmrg to <filename class="directory">/usr/share/sgml/docbook/xsl-ns-stylesheets</filename>. 75148fb7bfaSmrg </para> 75248fb7bfaSmrg 75348fb7bfaSmrg <para> 75448fb7bfaSmrg For processing XML, an XSLT processor and some style 75548fb7bfaSmrg sheets are necessary. Defaults are <command>xsltproc</command> 75648fb7bfaSmrg provided by <filename>libxslt</filename>. 75748fb7bfaSmrg </para> 75848fb7bfaSmrg 75948fb7bfaSmrg <para> 76048fb7bfaSmrg For validating the XML document, you'll need 76148fb7bfaSmrg something like <command>xmllint</command> and access to the 76248fb7bfaSmrg relevant DocBook schema. These are provided 76348fb7bfaSmrg by a vendor package like <filename>libxml2</filename> and <filename>docbook5-schemas-5.0-4</filename> 76448fb7bfaSmrg </para> 76548fb7bfaSmrg 76648fb7bfaSmrg <para> 76748fb7bfaSmrg For PDF output, something that transforms valid Docbook XML to PDF is 76848fb7bfaSmrg required. Possible solutions include <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dblatex.sourceforge.net">dblatex</link>, 76948fb7bfaSmrg <command>xmlto</command>, or <command>prince</command>. Of 770b17d1066Smrg these, <command>dblatex</command> is the default. 771b17d1066Smrg Please consult the <email>libstdc++@gcc.gnu.org</email> list when 77248fb7bfaSmrg preparing printed manuals for current best practice and 77348fb7bfaSmrg suggestions. 77448fb7bfaSmrg </para> 77548fb7bfaSmrg 77648fb7bfaSmrg <para> 77748fb7bfaSmrg For Texinfo output, something that transforms valid Docbook 77848fb7bfaSmrg 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>. 77948fb7bfaSmrg </para> 78048fb7bfaSmrg 78148fb7bfaSmrg <para> 782181254a7Smrg 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. 78348fb7bfaSmrg </para> 78448fb7bfaSmrg </section> 78548fb7bfaSmrg 78648fb7bfaSmrg <section xml:id="docbook.rules"><info><title>Generating the DocBook Files</title></info> 78748fb7bfaSmrg 78848fb7bfaSmrg 78948fb7bfaSmrg <para> 79048fb7bfaSmrg The following Makefile rules generate (in order): an HTML 79148fb7bfaSmrg version of all the DocBook documentation, a PDF version of the 79248fb7bfaSmrg same, and a single XML document. These rules are not 79348fb7bfaSmrg conditional! If the required tools are not found, or are the 79448fb7bfaSmrg wrong versions, the rule may end in an error. 79548fb7bfaSmrg </para> 79648fb7bfaSmrg 79748fb7bfaSmrg <para> 79848fb7bfaSmrg <screen><userinput>make doc-html-docbook</userinput></screen> 79948fb7bfaSmrg </para> 80048fb7bfaSmrg 80148fb7bfaSmrg <para> 80248fb7bfaSmrg <screen><userinput>make doc-pdf-docbook</userinput></screen> 80348fb7bfaSmrg </para> 80448fb7bfaSmrg 80548fb7bfaSmrg <para> 80648fb7bfaSmrg <screen><userinput>make doc-xml-single-docbook</userinput></screen> 80748fb7bfaSmrg </para> 80848fb7bfaSmrg 80948fb7bfaSmrg <para> 810003ba354Smrg Generated files are output into separate sub-directores of 81148fb7bfaSmrg <filename class="directory">doc/docbook/</filename> in the 81248fb7bfaSmrg build directory, based on the output format. For instance, the 81348fb7bfaSmrg HTML docs will be in <filename 81448fb7bfaSmrg class="directory">doc/docbook/html</filename>. 81548fb7bfaSmrg </para> 81648fb7bfaSmrg 81748fb7bfaSmrg <para> 818003ba354Smrg The <screen>doc-html-docbook-regenerate</screen> target will generate 819003ba354Smrg the HTML files and copy them back to the libstdc++ source tree. 820003ba354Smrg This can be used to update the HTML files that are checked in to 821003ba354Smrg version control. 822003ba354Smrg </para> 823003ba354Smrg 824003ba354Smrg <para> 82548fb7bfaSmrg If the Docbook stylesheets are installed in a custom location, 82648fb7bfaSmrg one can use the variable <literal>XSL_STYLE_DIR</literal> to 82748fb7bfaSmrg override the Makefile defaults. For example: 82848fb7bfaSmrg </para> 82948fb7bfaSmrg 83048fb7bfaSmrg <screen> 83148fb7bfaSmrg <userinput> 83248fb7bfaSmrgmake <literal>XSL_STYLE_DIR="/usr/share/xml/docbook/stylesheet/nwalsh"</literal> doc-html-docbook 83348fb7bfaSmrg </userinput> 83448fb7bfaSmrg </screen> 83548fb7bfaSmrg 83648fb7bfaSmrg </section> 83748fb7bfaSmrg 83848fb7bfaSmrg <section xml:id="docbook.debug"> 83948fb7bfaSmrg <info><title>Debugging Generation</title></info> 84048fb7bfaSmrg 84148fb7bfaSmrg <para> 84248fb7bfaSmrg Sometimes, mis-configuration of the pre-requisite tools can 84348fb7bfaSmrg lead to errors when attempting to build the 84448fb7bfaSmrg documentation. Here are some of the obvious errors, and ways 84548fb7bfaSmrg to fix some common issues that may appear quite cryptic. 84648fb7bfaSmrg </para> 84748fb7bfaSmrg 84848fb7bfaSmrg <para> 84948fb7bfaSmrg First, if using a rule like <code>make pdf</code>, try to 85048fb7bfaSmrg narrow down the scope of the error to either docbook 85148fb7bfaSmrg (<code>make doc-pdf-docbook</code>) or doxygen (<code>make 85248fb7bfaSmrg doc-pdf-doxygen</code>). 85348fb7bfaSmrg </para> 85448fb7bfaSmrg 85548fb7bfaSmrg <para> 85648fb7bfaSmrg Working on the docbook path only, closely examine the 85748fb7bfaSmrg contents of the following build directory: 8584d5abbe8Smrg <filename class="directory">build/target/libstdc++-v3/doc/docbook/latex</filename>. 85948fb7bfaSmrg Pay attention to three files enclosed within, annotated as follows. 86048fb7bfaSmrg </para> 86148fb7bfaSmrg 86248fb7bfaSmrg<itemizedlist> 86348fb7bfaSmrg 86448fb7bfaSmrg<listitem> 86548fb7bfaSmrg <para> 86648fb7bfaSmrg <emphasis>spine.tex</emphasis> 86748fb7bfaSmrg </para> 86848fb7bfaSmrg 86948fb7bfaSmrg <para> 87048fb7bfaSmrg The actual latex file, or partial latex file. This is generated 87148fb7bfaSmrg via <command>dblatex</command>, and is the LaTeX version of the 87248fb7bfaSmrg DocBook XML file <filename>spine.xml</filename>. Go to a specific 8734d5abbe8Smrg line, and look at the generated LaTeX, and try to deduce what 87448fb7bfaSmrg markup in <filename>spine.xml</filename> is causing it. 87548fb7bfaSmrg </para> 87648fb7bfaSmrg</listitem> 87748fb7bfaSmrg 87848fb7bfaSmrg<listitem> 87948fb7bfaSmrg <para> 88048fb7bfaSmrg <emphasis>spine.out</emphasis> 88148fb7bfaSmrg </para> 88248fb7bfaSmrg 88348fb7bfaSmrg <para> 88448fb7bfaSmrg A log of the conversion from the XML form to the LaTeX form. This 88548fb7bfaSmrg is a linear list, from the beginning of the 88648fb7bfaSmrg <filename>spine.xml</filename> file: the last entry of this file 88748fb7bfaSmrg should be the end of the DocBook file. If it is truncated, then 88848fb7bfaSmrg you know that the last entry is the last part of the XML source 88948fb7bfaSmrg file that is valid. The error is after this point. 89048fb7bfaSmrg </para> 89148fb7bfaSmrg</listitem> 89248fb7bfaSmrg 89348fb7bfaSmrg 89448fb7bfaSmrg<listitem> 89548fb7bfaSmrg <para> 89648fb7bfaSmrg <emphasis>spine.log</emphasis> 89748fb7bfaSmrg </para> 89848fb7bfaSmrg 89948fb7bfaSmrg <para> 90048fb7bfaSmrg A log of the compilation of the converted LaTeX form to pdf. This 90148fb7bfaSmrg is a linear list, from the beginning of the 90248fb7bfaSmrg <filename>spine.tex</filename> file: the last entry of this file 90348fb7bfaSmrg should be the end of the LaTeX file. If it is truncated, then you 90448fb7bfaSmrg know that the last entry is the last part of the generated LaTeX 90548fb7bfaSmrg source file that is valid. Often this file contains an error with 90648fb7bfaSmrg a specific line number of <filename>spine.tex</filename> that is 90748fb7bfaSmrg incorrect. 90848fb7bfaSmrg </para> 90948fb7bfaSmrg</listitem> 91048fb7bfaSmrg 91148fb7bfaSmrg</itemizedlist> 91248fb7bfaSmrg 91348fb7bfaSmrg <para> 91448fb7bfaSmrg If the error at hand is not obvious after examination, or if one 91548fb7bfaSmrg encounters the inscruitable <quote>Incomplete 91648fb7bfaSmrg \ifmmode</quote> error, a fall-back strategy is to start 91748fb7bfaSmrg commenting out parts of the XML document (regardless of what 91848fb7bfaSmrg this does to over-all document validity). Start by 91948fb7bfaSmrg commenting out each of the largest parts of the 92048fb7bfaSmrg <filename>spine.xml</filename> file, section by section, 92148fb7bfaSmrg until the offending section is identified. 92248fb7bfaSmrg </para> 92348fb7bfaSmrg 92448fb7bfaSmrg 92548fb7bfaSmrg </section> 92648fb7bfaSmrg 92748fb7bfaSmrg <section xml:id="docbook.validation"><info><title>Editing and Validation</title></info> 92848fb7bfaSmrg 92948fb7bfaSmrg <para> 93048fb7bfaSmrg After editing the xml sources, please make sure that the XML 93148fb7bfaSmrg documentation and markup is still valid. This can be 93248fb7bfaSmrg done easily, with the following validation rule: 93348fb7bfaSmrg </para> 93448fb7bfaSmrg 93548fb7bfaSmrg <screen> 93648fb7bfaSmrg <userinput>make doc-xml-validate-docbook</userinput> 93748fb7bfaSmrg </screen> 93848fb7bfaSmrg 93948fb7bfaSmrg <para> 94048fb7bfaSmrg This is equivalent to doing: 94148fb7bfaSmrg </para> 94248fb7bfaSmrg 94348fb7bfaSmrg <screen> 94448fb7bfaSmrg <userinput> 94548fb7bfaSmrg xmllint --noout --valid <filename>xml/index.xml</filename> 94648fb7bfaSmrg </userinput> 94748fb7bfaSmrg </screen> 94848fb7bfaSmrg 94948fb7bfaSmrg <para> 95048fb7bfaSmrg Please note that individual sections and chapters of the 95148fb7bfaSmrg manual can be validated by substituting the file desired for 95248fb7bfaSmrg <filename>xml/index.xml</filename> in the command 95348fb7bfaSmrg above. Reducing scope in this manner can be helpful when 95448fb7bfaSmrg validation on the entire manual fails. 95548fb7bfaSmrg </para> 95648fb7bfaSmrg 95748fb7bfaSmrg <para> 95848fb7bfaSmrg All Docbook xml sources should always validate. No excuses! 95948fb7bfaSmrg </para> 96048fb7bfaSmrg 96148fb7bfaSmrg </section> 96248fb7bfaSmrg 96348fb7bfaSmrg <section xml:id="docbook.examples"><info><title>File Organization and Basics</title></info> 96448fb7bfaSmrg 96548fb7bfaSmrg 96648fb7bfaSmrg <literallayout class="normal"> 96748fb7bfaSmrg <emphasis>Which files are important</emphasis> 96848fb7bfaSmrg 96948fb7bfaSmrg All Docbook files are in the directory 97048fb7bfaSmrg libstdc++-v3/doc/xml 97148fb7bfaSmrg 97248fb7bfaSmrg Inside this directory, the files of importance: 97348fb7bfaSmrg spine.xml - index to documentation set 97448fb7bfaSmrg manual/spine.xml - index to manual 97548fb7bfaSmrg manual/*.xml - individual chapters and sections of the manual 97648fb7bfaSmrg faq.xml - index to FAQ 97748fb7bfaSmrg api.xml - index to source level / API 97848fb7bfaSmrg 97948fb7bfaSmrg All *.txml files are template xml files, i.e., otherwise empty files with 98048fb7bfaSmrg the correct structure, suitable for filling in with new information. 98148fb7bfaSmrg 98248fb7bfaSmrg <emphasis>Canonical Writing Style</emphasis> 98348fb7bfaSmrg 98448fb7bfaSmrg class template 98548fb7bfaSmrg function template 98648fb7bfaSmrg member function template 98748fb7bfaSmrg (via C++ Templates, Vandevoorde) 98848fb7bfaSmrg 98948fb7bfaSmrg class in namespace std: allocator, not std::allocator 99048fb7bfaSmrg 99148fb7bfaSmrg header file: iostream, not <iostream> 99248fb7bfaSmrg 99348fb7bfaSmrg 99448fb7bfaSmrg <emphasis>General structure</emphasis> 99548fb7bfaSmrg 99648fb7bfaSmrg <set> 99748fb7bfaSmrg <book> 99848fb7bfaSmrg </book> 99948fb7bfaSmrg 100048fb7bfaSmrg <book> 100148fb7bfaSmrg <chapter> 100248fb7bfaSmrg </chapter> 100348fb7bfaSmrg </book> 100448fb7bfaSmrg 100548fb7bfaSmrg <book> 100648fb7bfaSmrg <part> 100748fb7bfaSmrg <chapter> 100848fb7bfaSmrg <section> 100948fb7bfaSmrg </section> 101048fb7bfaSmrg 101148fb7bfaSmrg <sect1> 101248fb7bfaSmrg </sect1> 101348fb7bfaSmrg 101448fb7bfaSmrg <sect1> 101548fb7bfaSmrg <sect2> 101648fb7bfaSmrg </sect2> 101748fb7bfaSmrg </sect1> 101848fb7bfaSmrg </chapter> 101948fb7bfaSmrg 102048fb7bfaSmrg <chapter> 102148fb7bfaSmrg </chapter> 102248fb7bfaSmrg </part> 102348fb7bfaSmrg </book> 102448fb7bfaSmrg 102548fb7bfaSmrg </set> 102648fb7bfaSmrg </literallayout> 102748fb7bfaSmrg </section> 102848fb7bfaSmrg 102948fb7bfaSmrg <section xml:id="docbook.markup"><info><title>Markup By Example</title></info> 103048fb7bfaSmrg 103148fb7bfaSmrg 103248fb7bfaSmrg <para> 1033b17d1066Smrg Complete details on Docbook markup can be found in the 1034a3e9eb18Smrg <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>. 103548fb7bfaSmrg An incomplete reference for HTML to Docbook conversion is 103648fb7bfaSmrg detailed in the table below. 103748fb7bfaSmrg </para> 103848fb7bfaSmrg 10394d5abbe8Smrg<table frame="all" xml:id="table.docbook_cmp"> 104048fb7bfaSmrg<title>HTML to Docbook XML Markup Comparison</title> 104148fb7bfaSmrg 104248fb7bfaSmrg<tgroup cols="2" align="left" colsep="1" rowsep="1"> 104348fb7bfaSmrg<colspec colname="c1"/> 104448fb7bfaSmrg<colspec colname="c2"/> 104548fb7bfaSmrg 104648fb7bfaSmrg <thead> 104748fb7bfaSmrg <row> 104848fb7bfaSmrg <entry>HTML</entry> 104948fb7bfaSmrg <entry>Docbook</entry> 105048fb7bfaSmrg </row> 105148fb7bfaSmrg </thead> 105248fb7bfaSmrg 105348fb7bfaSmrg <tbody> 105448fb7bfaSmrg <row> 105548fb7bfaSmrg <entry><p></entry> 105648fb7bfaSmrg <entry><para></entry> 105748fb7bfaSmrg </row> 105848fb7bfaSmrg <row> 105948fb7bfaSmrg <entry><pre></entry> 106048fb7bfaSmrg <entry><computeroutput>, <programlisting>, 106148fb7bfaSmrg <literallayout></entry> 106248fb7bfaSmrg </row> 106348fb7bfaSmrg <row> 106448fb7bfaSmrg <entry><ul></entry> 106548fb7bfaSmrg <entry><itemizedlist></entry> 106648fb7bfaSmrg </row> 106748fb7bfaSmrg <row> 106848fb7bfaSmrg <entry><ol></entry> 106948fb7bfaSmrg <entry><orderedlist></entry> 107048fb7bfaSmrg </row> 107148fb7bfaSmrg <row> 107248fb7bfaSmrg <entry><il></entry> 107348fb7bfaSmrg <entry><listitem></entry> 107448fb7bfaSmrg </row> 107548fb7bfaSmrg <row> 107648fb7bfaSmrg <entry><dl></entry> 107748fb7bfaSmrg <entry><variablelist></entry> 107848fb7bfaSmrg </row> 107948fb7bfaSmrg <row> 108048fb7bfaSmrg <entry><dt></entry> 108148fb7bfaSmrg <entry><term></entry> 108248fb7bfaSmrg </row> 108348fb7bfaSmrg <row> 108448fb7bfaSmrg <entry><dd></entry> 108548fb7bfaSmrg <entry><listitem></entry> 108648fb7bfaSmrg </row> 108748fb7bfaSmrg 108848fb7bfaSmrg <row> 108948fb7bfaSmrg <entry><a href=""></entry> 109048fb7bfaSmrg <entry><ulink url=""></entry> 109148fb7bfaSmrg </row> 109248fb7bfaSmrg <row> 109348fb7bfaSmrg <entry><code></entry> 109448fb7bfaSmrg <entry><literal>, <programlisting></entry> 109548fb7bfaSmrg </row> 109648fb7bfaSmrg <row> 109748fb7bfaSmrg <entry><strong></entry> 109848fb7bfaSmrg <entry><emphasis></entry> 109948fb7bfaSmrg </row> 110048fb7bfaSmrg <row> 110148fb7bfaSmrg <entry><em></entry> 110248fb7bfaSmrg <entry><emphasis></entry> 110348fb7bfaSmrg </row> 110448fb7bfaSmrg <row> 110548fb7bfaSmrg <entry>"</entry> 110648fb7bfaSmrg <entry><quote></entry> 110748fb7bfaSmrg </row> 110848fb7bfaSmrg </tbody> 110948fb7bfaSmrg</tgroup> 111048fb7bfaSmrg</table> 111148fb7bfaSmrg 111248fb7bfaSmrg<para> 111348fb7bfaSmrg And examples of detailed markup for which there are no real HTML 111448fb7bfaSmrg equivalents are listed in the table below. 111548fb7bfaSmrg</para> 111648fb7bfaSmrg 11174d5abbe8Smrg<table frame="all" xml:id="table.docbook_elem"> 111848fb7bfaSmrg<title>Docbook XML Element Use</title> 111948fb7bfaSmrg 112048fb7bfaSmrg<tgroup cols="2" align="left" colsep="1" rowsep="1"> 112148fb7bfaSmrg<colspec colname="c1"/> 112248fb7bfaSmrg<colspec colname="c2"/> 112348fb7bfaSmrg 112448fb7bfaSmrg <thead> 112548fb7bfaSmrg <row> 112648fb7bfaSmrg <entry>Element</entry> 112748fb7bfaSmrg <entry>Use</entry> 112848fb7bfaSmrg </row> 112948fb7bfaSmrg </thead> 113048fb7bfaSmrg 113148fb7bfaSmrg <tbody> 113248fb7bfaSmrg <row> 113348fb7bfaSmrg <entry><structname></entry> 113448fb7bfaSmrg <entry><structname>char_traits</structname></entry> 113548fb7bfaSmrg </row> 113648fb7bfaSmrg <row> 113748fb7bfaSmrg <entry><classname></entry> 113848fb7bfaSmrg <entry><classname>string</classname></entry> 113948fb7bfaSmrg </row> 114048fb7bfaSmrg <row> 114148fb7bfaSmrg <entry><function></entry> 114248fb7bfaSmrg <entry> 114348fb7bfaSmrg <para><function>clear()</function></para> 114448fb7bfaSmrg <para><function>fs.clear()</function></para> 114548fb7bfaSmrg </entry> 114648fb7bfaSmrg </row> 114748fb7bfaSmrg <row> 114848fb7bfaSmrg <entry><type></entry> 114948fb7bfaSmrg <entry><type>long long</type></entry> 115048fb7bfaSmrg </row> 115148fb7bfaSmrg <row> 115248fb7bfaSmrg <entry><varname></entry> 115348fb7bfaSmrg <entry><varname>fs</varname></entry> 115448fb7bfaSmrg </row> 115548fb7bfaSmrg <row> 115648fb7bfaSmrg <entry><literal></entry> 115748fb7bfaSmrg <entry> 115848fb7bfaSmrg <para><literal>-Weffc++</literal></para> 115948fb7bfaSmrg <para><literal>rel_ops</literal></para> 116048fb7bfaSmrg </entry> 116148fb7bfaSmrg </row> 116248fb7bfaSmrg <row> 116348fb7bfaSmrg <entry><constant></entry> 116448fb7bfaSmrg <entry> 116548fb7bfaSmrg <para><constant>_GNU_SOURCE</constant></para> 116648fb7bfaSmrg <para><constant>3.0</constant></para> 116748fb7bfaSmrg </entry> 116848fb7bfaSmrg </row> 116948fb7bfaSmrg <row> 117048fb7bfaSmrg <entry><command></entry> 117148fb7bfaSmrg <entry><command>g++</command></entry> 117248fb7bfaSmrg </row> 117348fb7bfaSmrg <row> 117448fb7bfaSmrg <entry><errortext></entry> 117548fb7bfaSmrg <entry><errortext>In instantiation of</errortext></entry> 117648fb7bfaSmrg </row> 117748fb7bfaSmrg <row> 117848fb7bfaSmrg <entry><filename></entry> 117948fb7bfaSmrg <entry> 118048fb7bfaSmrg <para><filename class="headerfile">ctype.h</filename></para> 118148fb7bfaSmrg <para><filename class="directory">/home/gcc/build</filename></para> 118248fb7bfaSmrg <para><filename class="libraryfile">libstdc++.so</filename></para> 118348fb7bfaSmrg </entry> 118448fb7bfaSmrg </row> 118548fb7bfaSmrg </tbody> 118648fb7bfaSmrg</tgroup> 118748fb7bfaSmrg</table> 118848fb7bfaSmrg 118948fb7bfaSmrg</section> 119048fb7bfaSmrg</section> 119148fb7bfaSmrg</section> 1192