OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [doc/] [xml/] [manual/] [documentation_hacking.xml] - Blame information for rev 745

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
2
         xml:id="appendix.porting.doc" xreflabel="Documentation Hacking">
3
4
 
5
Writing and Generating Documentation
6
  
7
    ISO C++
8
    documentation
9
    style
10
    docbook
11
    doxygen
12
  
13
14
 
15
  
16
    
17
    Introduction
18
    
19
    
20
      Documentation for the GNU C++ Library is created from three
21
      independent sources: a manual, a FAQ, and an API reference.
22
    
23
    
24
      The sub-directory doc
25
      within the main source directory contains
26
      Makefile.am and
27
      Makefile.in, which provide rules for
28
      generating documentation, described in excruciating detail
29
      below. The doc
30
      sub-directory also contains three directories: 
31
      class="directory">doxygen, which contains scripts and
32
      fragments for doxygen, 
33
      class="directory">html, which contains an html
34
      version of the manual, and 
35
      class="directory">xml, which contains an xml version
36
      of the manual.
37
    
38
    
39
      Diverging from established documentation conventions in the rest
40
      of the GCC project, libstdc++ does not use Texinfo as a markup
41
      language. Instead, Docbook is used to create the manual and the
42
      FAQ, and Doxygen is used to construct the API
43
      reference. Although divergent, this conforms to the GNU Project
44
      recommendations as long as the output is of sufficient quality,
45
      as per
46
      
47
      xlink:href="http://www.gnu.org/prep/standards/standards.html#Documentation">
48
      GNU Manuals.
49
    
50
  
51
 
52
  
53
    
54
    Generating Documentation
55
    
56
 
57
    
58
      Certain Makefile rules are required by the GNU Coding
59
      Standards. These standard rules generate HTML, PDF, XML, or man
60
      files. For each of the generative rules, there is an additional
61
      install rule that is used to install any generated documentation
62
      files into the prescribed installation directory. Files are
63
      installed into share/doc
64
      or share/man directories.
65
    
66
 
67
    
68
      The standard Makefile rules are conditionally supported, based
69
      on the results of examining the host environment for
70
      prerequisites at configuration time. If requirements are not
71
      found, the rule is aliased to a dummy rule that does nothing,
72
      and produces no documentation. If the requirements are found,
73
      the rule forwards to a private rule that produces the requested
74
      documentation.
75
    
76
 
77
    
78
      For more details on what prerequisites were found and where,
79
      please consult the file config.log in the
80
      libstdc++ build directory. Compare this log to what is expected
81
      for the relevant Makefile conditionals:
82
      BUILD_INFO, BUILD_XML,
83
      BUILD_HTML, BUILD_MAN,
84
      BUILD_PDF, and BUILD_EPUB.
85
    
86
 
87
    
88
      Supported Makefile rules:
89
    
90
 
91
    
92
      
93
        
94
          make html
95
        
96
        
97
          make install-html
98
        
99
        
100
          
101
            Generates multi-page HTML documentation, and installs it
102
            in the following directories:
103
          
104
          
105
            
106
              doc/libstdc++/libstdc++-api.html
107
            
108
          
109
          
110
            
111
              doc/libstdc++/libstdc++-manual.html
112
            
113
          
114
        
115
      
116
 
117
      
118
        
119
          make pdf
120
        
121
        
122
          make install-pdf
123
        
124
        
125
          
126
            Generates indexed PDF documentation, and installs it as
127
            the following files:
128
          
129
          
130
            doc/libstdc++/libstdc++-api.pdf
131
          
132
          
133
            doc/libstdc++/libstdc++-manual.pdf
134
          
135
        
136
      
137
 
138
      
139
        
140
          make man
141
        
142
        
143
          make install-man
144
        
145
        
146
          
147
            Generates man pages, and installs it in the following directory:
148
          
149
          
150
            man/man3/
151
          
152
          
153
            The generated man pages are namespace-qualified, so to look at
154
            the man page for vector, one would use
155
            man std::vector.
156
          
157
        
158
      
159
 
160
      
161
        
162
          make epub
163
        
164
        
165
          make install-epub
166
        
167
        
168
          
169
            Generates documentation in the ebook/portable electronic
170
            reader format called Epub, and installs it as the
171
            following file.
172
          
173
          
174
            doc/libstdc++/libstdc++-manual.epub
175
          
176
        
177
      
178
 
179
      
180
        
181
          make xml
182
        
183
        
184
          make install-xml
185
        
186
        
187
          
188
            Generates single-file XML documentation, and installs it
189
            as the following files:
190
          
191
          
192
            doc/libstdc++/libstdc++-api-single.xml
193
          
194
          
195
            doc/libstdc++/libstdc++-manual-single.xml
196
          
197
        
198
      
199
    
200
 
201
    
202
      Makefile rules for several other formats are explicitly not
203
      supported, and are always aliased to dummy rules. These
204
      unsupported formats are: info,
205
      ps, and dvi.
206
    
207
  
208
 
209
  
Doxygen
210
 
211
    
Prerequisites
212
 
213
 
214
Doxygen Prerequisites
215
 
216
217
218
219
220
 
221
  
222
    
223
      Tool
224
      Version
225
      Required By
226
    
227
  
228
 
229
  
230
 
231
    
232
      coreutils
233
      8.5
234
      all
235
    
236
 
237
    
238
      bash
239
      4.1
240
      all
241
    
242
 
243
    
244
      doxygen
245
      1.7.6.1
246
      all
247
    
248
 
249
    
250
      graphviz
251
      2.26
252
      graphical hierarchies
253
    
254
 
255
    
256
      pdflatex
257
      2007-59
258
      pdf output
259
    
260
 
261
  
262
263
264
 
265
 
266
      
267
        Prerequisite tools are Bash 2.0 or later,
268
        Doxygen, and
269
        the GNU
270
        coreutils. (GNU versions of find, xargs, and possibly
271
        sed and grep are used, just because the GNU versions make
272
        things very easy.)
273
      
274
 
275
      
276
        To generate the pretty pictures and hierarchy
277
        graphs, the
278
        Graphviz package
279
        will need to be installed. For PDF
280
        output, 
281
        pdflatex is required.
282
      
283
 
284
      
285
        Be warned the PDF file generated via doxygen is extremely
286
        large. At last count, the PDF file is over three thousand
287
        pages. Generating this document taxes the underlying TeX
288
        formatting system, and will require the expansion of TeX's memory
289
        capacity. Specifically, the pool_size
290
        variable in the configuration file texmf.cnf may
291
        need to be increased by a minimum factor of two.
292
      
293
    
294
 
295
    
Generating the Doxygen Files
296
 
297
      
298
        The following Makefile rules run Doxygen to generate HTML
299
        docs, XML docs, XML docs as a single file, PDF docs, and the
300
        man pages. These rules are not conditional! If the required
301
        tools are not found, or are the wrong versions, the rule may
302
        end in an error.
303
      
304
 
305
      
306
      make doc-html-doxygen
307
      
308
 
309
      
310
      make doc-xml-doxygen
311
      
312
 
313
      
314
      make doc-xml-single-doxygen
315
      
316
 
317
      
318
      make doc-pdf-doxygen
319
      
320
 
321
      
322
      make doc-man-doxygen
323
      
324
 
325
      
326
        Generated files are output into separate sub directories of
327
        doc/doxygen/ in the
328
        build directory, based on the output format. For instance, the
329
        HTML docs will be in doc/doxygen/html.
330
      
331
 
332
      
333
        Careful observers will see that the Makefile rules simply call
334
        a script from the source tree, run_doxygen, which
335
        does the actual work of running Doxygen and then (most
336
        importantly) massaging the output files. If for some reason
337
        you prefer to not go through the Makefile, you can call this
338
        script directly. (Start by passing --help.)
339
      
340
 
341
      
342
        If you wish to tweak the Doxygen settings, do so by editing
343
        doc/doxygen/user.cfg.in. Notes to fellow
344
        library hackers are written in triple-# comments.
345
      
346
 
347
    
348
 
349
    
Markup
350
 
351
 
352
      
353
        In general, libstdc++ files should be formatted according to
354
        the rules found in the
355
        Coding Standard. Before
356
        any doxygen-specific formatting tweaks are made, please try to
357
        make sure that the initial formatting is sound.
358
      
359
 
360
      
361
        Adding Doxygen markup to a file (informally called
362
        doxygenating) is very simple. The Doxygen manual can be
363
        found
364
        here.
365
        We try to use a very-recent version of Doxygen.
366
      
367
 
368
      
369
        For classes, use
370
        deque/vector/list
371
        and std::pair as examples.  For
372
        functions, see their member functions, and the free functions
373
        in stl_algobase.h. Member functions of
374
        other container-like types should read similarly to these
375
        member functions.
376
      
377
 
378
      
379
        Some commentary to accompany
380
        the first list in the Special
381
        Documentation Blocks section of
382
        the Doxygen manual:
383
      
384
 
385
      
386
        
387
          For longer comments, use the Javadoc style...
388
        
389
 
390
        
391
          
392
            ...not the Qt style. The intermediate *'s are preferred.
393
          
394
        
395
 
396
        
397
          
398
            Use the triple-slash style only for one-line comments (the
399
            brief mode).
400
          
401
        
402
 
403
        
404
          
405
            This is disgusting. Don't do this.
406
          
407
        
408
      
409
 
410
      
411
        Some specific guidelines:
412
      
413
 
414
      
415
        Use the @-style of commands, not the !-style. Please be
416
        careful about whitespace in your markup comments. Most of the
417
        time it doesn't matter; doxygen absorbs most whitespace, and
418
        both HTML and *roff are agnostic about whitespace. However,
419
        in <pre> blocks and @code/@endcode sections, spacing can
420
        have interesting effects.
421
      
422
 
423
      
424
        Use either kind of grouping, as
425
        appropriate. doxygroups.cc exists for this
426
        purpose. See stl_iterator.h for a good example
427
        of the other kind of grouping.
428
      
429
 
430
      
431
        Please use markup tags like @p and @a when referring to things
432
        such as the names of function parameters. Use @e for emphasis
433
        when necessary. Use @c to refer to other standard names.
434
        (Examples of all these abound in the present code.)
435
      
436
 
437
      
438
        Complicated math functions should use the multi-line
439
        format. An example from random.h:
440
      
441
 
442
      
443
444
/**
445
 * @brief A model of a linear congruential random number generator.
446
 *
447
 * @f[
448
 *     x_{i+1}\leftarrow(ax_{i} + c) \bmod m
449
 * @f]
450
 */
451
452
      
453
 
454
      
455
        One area of note is the markup required for
456
        @file markup in header files. Two details
457
        are important: for filenames that have the same name in
458
        multiple directories, include part of the installed path to
459
        disambiguate. For example:
460
      
461
 
462
      
463
464
/** @file debug/vector
465
 *  This file is a GNU debug extension to the Standard C++ Library.
466
 */
467
468
      
469
 
470
      
471
        The other relevant detail for header files is the use of a
472
        libstdc++-specific doxygen alias that helps distinguish
473
        between public header files (like random)
474
        from implementation or private header files (like
475
        bits/c++config.h.) This alias is spelled
476
        @headername and can take one or two
477
        arguments that detail the public header file or files that
478
        should be included to use the contents of the file. All header
479
        files that are not intended for direct inclusion must use
480
        headername in the file
481
        block. An example:
482
      
483
 
484
      
485
486
/** @file bits/basic_string.h
487
 *  This is an internal header file, included by other library headers.
488
 *  Do not attempt to use it directly. @headername{string}
489
 */
490
491
      
492
 
493
      
494
        Be careful about using certain, special characters when
495
        writing Doxygen comments. Single and double quotes, and
496
        separators in filenames are two common trouble spots. When in
497
        doubt, consult the following table.
498
      
499
 
500
501
HTML to Doxygen Markup Comparison
502
 
503
504
505
506
 
507
  
508
    
509
      HTML
510
      Doxygen
511
    
512
  
513
 
514
  
515
    
516
      \
517
      \\
518
    
519
 
520
    
521
      "
522
      \"
523
    
524
 
525
    
526
      '
527
      \'
528
    
529
 
530
    
531
      <i>
532
      @a word
533
    
534
 
535
    
536
      <b>
537
      @b word
538
    
539
 
540
    
541
      <code>
542
      @c word
543
    
544
 
545
    
546
      <em>
547
      @a word
548
    
549
 
550
    
551
      <em>
552
      <em>two words or more</em>
553
    
554
  
555
 
556
557
558
 
559
 
560
    
561
 
562
  
563
 
564
  
Docbook
565
 
566
 
567
    
Prerequisites
568
 
569
 
570
 
571
Docbook Prerequisites
572
 
573
574
575
576
577
 
578
  
579
    
580
      Tool
581
      Version
582
      Required By
583
    
584
  
585
 
586
  
587
 
588
    
589
      docbook5-style-xsl
590
      1.76.1
591
      all
592
    
593
 
594
    
595
      xsltproc
596
      1.1.26
597
      all
598
    
599
 
600
    
601
      xmllint
602
      2.7.7
603
      validation
604
    
605
 
606
    
607
      dblatex
608
      0.3
609
      pdf output
610
    
611
 
612
    
613
      pdflatex
614
      2007-59
615
      pdf output
616
    
617
 
618
    
619
      docbook2X
620
      0.8.8
621
      info output
622
    
623
 
624
    
625
      epub3 stylesheets
626
      b3
627
      epub output
628
    
629
 
630
  
631
632
633
 
634
      
635
        Editing the DocBook sources requires an XML editor. Many
636
        exist: some notable options
637
        include emacs, Kate,
638
        or Conglomerate.
639
      
640
 
641
      
642
        Some editors support special XML Validation
643
        modes that can validate the file as it is
644
        produced. Recommended is the nXML Mode
645
        for emacs.
646
      
647
 
648
      
649
        Besides an editor, additional DocBook files and XML tools are
650
        also required.
651
      
652
 
653
      
654
        Access to the DocBook 5.0 stylesheets and schema is required. The
655
        stylesheets are usually packaged by vendor, in something
656
        like docbook5-style-xsl. To exactly match
657
        generated output, please use a version of the stylesheets
658
        equivalent
659
        to docbook5-style-xsl-1.75.2-3. The
660
        installation directory for this package corresponds to
661
        the XSL_STYLE_DIR
662
        in doc/Makefile.am and defaults
663
        to /usr/share/sgml/docbook/xsl-ns-stylesheets.
664
      
665
 
666
      
667
        For processing XML, an XSLT processor and some style
668
        sheets are necessary. Defaults are xsltproc
669
        provided by libxslt.
670
      
671
 
672
      
673
        For validating the XML document, you'll need
674
        something like xmllint and access to the
675
        relevant DocBook schema. These are provided
676
        by a vendor package like libxml2 and docbook5-schemas-5.0-4
677
      
678
 
679
      
680
        For PDF output, something that transforms valid Docbook XML to PDF is
681
        required. Possible solutions include dblatex,
682
        xmlto, or prince. Of
683
        these, dblatex is the default. Other
684
        options are listed on the DocBook web pages. Please
685
        consult the libstdc++@gcc.gnu.org list when
686
        preparing printed manuals for current best practice and
687
        suggestions.
688
      
689
 
690
      
691
        For Texinfo output, something that transforms valid Docbook
692
        XML to Texinfo is required. The default choice is docbook2X.
693
      
694
 
695
      
696
        For epub output, the stylesheets for EPUB3 are required. These stylesheets are still in development. To validate the created file, epubcheck is necessary.
697
      
698
    
699
 
700
    
Generating the DocBook Files
701
 
702
 
703
      
704
        The following Makefile rules generate (in order): an HTML
705
        version of all the DocBook documentation, a PDF version of the
706
        same, and a single XML document.  These rules are not
707
        conditional! If the required tools are not found, or are the
708
        wrong versions, the rule may end in an error.
709
      
710
 
711
      
712
      make doc-html-docbook
713
      
714
 
715
      
716
      make doc-pdf-docbook
717
      
718
 
719
      
720
      make doc-xml-single-docbook
721
      
722
 
723
      
724
        Generated files are output into separate sub directores of
725
        doc/docbook/ in the
726
        build directory, based on the output format. For instance, the
727
        HTML docs will be in 
728
        class="directory">doc/docbook/html.
729
      
730
 
731
      
732
        If the Docbook stylesheets are installed in a custom location,
733
        one can use the variable XSL_STYLE_DIR to
734
        override the Makefile defaults. For example:
735
      
736
 
737
      
738
        
739
make XSL_STYLE_DIR="/usr/share/xml/docbook/stylesheet/nwalsh" doc-html-docbook
740
        
741
      
742
 
743
      
744
 
745
    
Editing and Validation
746
 
747
      
748
        After editing the xml sources, please make sure that the XML
749
        documentation and markup is still valid. This can be
750
        done easily, with the following validation rule:
751
      
752
 
753
      
754
        make doc-xml-validate-docbook
755
      
756
 
757
      
758
        This is equivalent to doing:
759
      
760
 
761
      
762
        
763
          xmllint --noout --valid xml/index.xml
764
        
765
      
766
 
767
      
768
        Please note that individual sections and chapters of the
769
        manual can be validated by substituting the file desired for
770
        xml/index.xml in the command
771
        above. Reducing scope in this manner can be helpful when
772
        validation on the entire manual fails.
773
      
774
 
775
      
776
        All Docbook xml sources should always validate. No excuses!
777
      
778
 
779
    
780
 
781
    
File Organization and Basics
782
 
783
 
784
    
785
      Which files are important
786
 
787
      All Docbook files are in the directory
788
      libstdc++-v3/doc/xml
789
 
790
      Inside this directory, the files of importance:
791
      spine.xml         - index to documentation set
792
      manual/spine.xml  - index to manual
793
      manual/*.xml      - individual chapters and sections of the manual
794
      faq.xml           - index to FAQ
795
      api.xml           - index to source level / API
796
 
797
      All *.txml files are template xml files, i.e., otherwise empty files with
798
      the correct structure, suitable for filling in with new information.
799
 
800
      Canonical Writing Style
801
 
802
      class template
803
      function template
804
      member function template
805
      (via C++ Templates, Vandevoorde)
806
 
807
      class in namespace std: allocator, not std::allocator
808
 
809
      header file: iostream, not <iostream>
810
 
811
 
812
      General structure
813
 
814
      <set>
815
      <book>
816
      </book>
817
 
818
      <book>
819
      <chapter>
820
      </chapter>
821
      </book>
822
 
823
      <book>
824
      <part>
825
      <chapter>
826
      <section>
827
      </section>
828
 
829
      <sect1>
830
      </sect1>
831
 
832
      <sect1>
833
      <sect2>
834
      </sect2>
835
      </sect1>
836
      </chapter>
837
 
838
      <chapter>
839
      </chapter>
840
      </part>
841
      </book>
842
 
843
      </set>
844
    
845
    
846
 
847
    
Markup By Example
848
 
849
 
850
      
851
        Complete details on Docbook markup can be found in the DocBook
852
        Element Reference,
853
        online.
854
        An incomplete reference for HTML to Docbook conversion is
855
        detailed in the table below.
856
      
857
 
858
859
HTML to Docbook XML Markup Comparison
860
 
861
862
863
864
 
865
  
866
    
867
      HTML
868
      Docbook
869
    
870
  
871
 
872
  
873
    
874
      <p>
875
      <para>
876
    
877
    
878
      <pre>
879
      <computeroutput>, <programlisting>,
880
        <literallayout>
881
    
882
    
883
      <ul>
884
      <itemizedlist>
885
    
886
    
887
      <ol>
888
      <orderedlist>
889
    
890
    
891
      <il>
892
      <listitem>
893
    
894
    
895
      <dl>
896
      <variablelist>
897
    
898
    
899
      <dt>
900
      <term>
901
    
902
    
903
      <dd>
904
      <listitem>
905
    
906
 
907
    
908
      <a href="">
909
      <ulink url="">
910
    
911
    
912
      <code>
913
      <literal>, <programlisting>
914
    
915
    
916
      <strong>
917
      <emphasis>
918
    
919
    
920
      <em>
921
      <emphasis>
922
    
923
    
924
      "
925
      <quote>
926
    
927
   
928
929
930
 
931
932
  And examples of detailed markup for which there are no real HTML
933
  equivalents are listed in the table below.
934
935
 
936
937
Docbook XML Element Use
938
 
939
940
941
942
 
943
  
944
    
945
      Element
946
      Use
947
    
948
  
949
 
950
  
951
    
952
      <structname>
953
      <structname>char_traits</structname>
954
    
955
    
956
      <classname>
957
      <classname>string</classname>
958
    
959
    
960
      <function>
961
      
962
        <function>clear()</function>
963
        <function>fs.clear()</function>
964
      
965
    
966
    
967
      <type>
968
      <type>long long</type>
969
    
970
    
971
      <varname>
972
      <varname>fs</varname>
973
    
974
    
975
      <literal>
976
      
977
        <literal>-Weffc++</literal>
978
        <literal>rel_ops</literal>
979
      
980
    
981
    
982
      <constant>
983
      
984
        <constant>_GNU_SOURCE</constant>
985
        <constant>3.0</constant>
986
      
987
    
988
    
989
      <command>
990
      <command>g++</command>
991
    
992
    
993
      <errortext>
994
      <errortext>In instantiation of</errortext>
995
    
996
    
997
      <filename>
998
      
999
        <filename class="headerfile">ctype.h</filename>
1000
        <filename class="directory">/home/gcc/build</filename>
1001
        <filename class="libraryfile">libstdc++.so</filename>
1002
      
1003
    
1004
   
1005
1006
1007
 
1008
1009
1010

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.