libstdc++: Remove std::__is_pointer and std::__is_scalar [PR115497]
[official-gcc.git] / gcc / ada / gnat-style.texi
blob29b4c886561bc657684e93681b6e5f49dc2829ff
1 \input texinfo   @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename gnat-style.info
4 @documentencoding UTF-8
5 @ifinfo
6 @*Generated by Sphinx 5.3.0.@*
7 @end ifinfo
8 @settitle GNAT Coding Style A Guide for GNAT Developers
9 @defindex ge
10 @paragraphindent 0
11 @exampleindent 4
12 @finalout
13 @dircategory GNU Ada Tools 
14 @direntry
15 * gnat-style: (gnat-style.info). gnat-style
16 @end direntry
18 @c %**end of header
20 @copying
21 @quotation
22 GNAT Coding Style: A Guide for GNAT Developers , Dec 21, 2023
24 AdaCore
26 Copyright @copyright{} 2008-2024, Free Software Foundation
27 @end quotation
29 @end copying
31 @titlepage
32 @title GNAT Coding Style A Guide for GNAT Developers
33 @insertcopying
34 @end titlepage
35 @contents
37 @c %** start of user preamble
39 @c %** end of user preamble
41 @ifnottex
42 @node Top
43 @top GNAT Coding Style A Guide for GNAT Developers
44 @insertcopying
45 @end ifnottex
47 @c %**start of body
48 @anchor{gnat-style doc}@anchor{0}
49 @menu
50 * General:: 
51 * Lexical Elements:: 
52 * Declarations and Types:: 
53 * Expressions and Names:: 
54 * Statements:: 
55 * Subprograms:: 
56 * Packages and Visibility Rules:: 
57 * Program Structure and Compilation Issues:: 
58 * Index:: 
60 @end menu
62 @node General,Lexical Elements,Top,Top
63 @anchor{gnat-style general}@anchor{1}@anchor{gnat-style gnat-coding-style-a-guide-for-gnat-developers}@anchor{2}
64 @chapter General
67 Most of GNAT is written in Ada using a consistent style to ensure
68 readability of the code.  This document has been written to help
69 maintain this consistent style, while having a large group of developers
70 work on the compiler.
72 For the coding style in the C parts of the compiler and run time,
73 see the GNU Coding Guidelines.
75 This document is structured after the Ada Reference Manual.
76 Those familiar with that document should be able to quickly
77 lookup style rules for particular constructs.
79 @node Lexical Elements,Declarations and Types,General,Top
80 @anchor{gnat-style lexical-elements}@anchor{3}
81 @chapter Lexical Elements
84 @menu
85 * Character Set and Separators:: 
86 * Identifiers:: 
87 * Numeric Literals:: 
88 * Reserved Words:: 
89 * Comments:: 
91 @end menu
93 @node Character Set and Separators,Identifiers,,Lexical Elements
94 @anchor{gnat-style character-set-and-separators}@anchor{4}
95 @section Character Set and Separators
98 @geindex Character set
100 @geindex ASCII
102 @geindex Separators
104 @geindex End-of-line
106 @geindex Line length
108 @geindex Indentation
111 @itemize *
113 @item 
114 The character set used should be plain 7-bit ASCII.
115 The only separators allowed are space and the end-of-line sequence.
116 No other control character or format effector (such as @code{HT},
117 @code{VT}, @code{FF} )
118 should be used.
119 The normal end-of-line sequence is used, which may be
120 @code{LF}, @code{CR/LF} or @code{CR},
121 depending on the host system.  An optional @code{SUB}
122 ( @code{16#1A#} ) may be present as the
123 last character in the file on hosts using that character as file terminator.
125 @item 
126 Files that are checked in or distributed should be in host format.
128 @item 
129 A line should never be longer than 79 characters, not counting the line
130 separator.
132 @item 
133 Lines must not have trailing blanks.
135 @item 
136 Indentation is 3 characters per level for @code{if} statements, loops, and
137 @code{case} statements.
138 For exact information on required spacing between lexical
139 elements, see file style.adb.
141 @geindex style.adb file
142 @end itemize
144 @node Identifiers,Numeric Literals,Character Set and Separators,Lexical Elements
145 @anchor{gnat-style identifiers}@anchor{5}
146 @section Identifiers
150 @itemize *
152 @item 
153 Identifiers will start with an upper case letter, and each letter following
154 an underscore will be upper case.
156 @geindex Casing (for identifiers)
158 Short acronyms may be all upper case.
159 All other letters are lower case.
160 An exception is for identifiers matching a foreign language.  In particular,
161 we use all lower case where appropriate for C.
163 @item 
164 Use underscores to separate words in an identifier.
166 @geindex Underscores
168 @item 
169 Try to limit your use of abbreviations in identifiers.
170 It is ok to make a few abbreviations, explain what they mean, and then
171 use them frequently, but don’t use lots of obscure abbreviations.  An
172 example is the @code{ALI} word which stands for Ada Library
173 Information and is by convention always written in upper-case when
174 used in entity names.
176 @example
177 procedure Find_ALI_Files;
178 @end example
180 @item 
181 Don’t use the variable name @code{I}, use @code{J} instead; @code{I} is too
182 easily confused with @code{1} in some fonts.  Similarly don’t use the
183 variable @code{O}, which is too easily mistaken for the number @code{0}.
184 @end itemize
186 @node Numeric Literals,Reserved Words,Identifiers,Lexical Elements
187 @anchor{gnat-style numeric-literals}@anchor{6}
188 @section Numeric Literals
192 @itemize *
194 @item 
195 Numeric literals should include underscores where helpful for
196 readability.
198 @geindex Underscores
200 @example
201 1_000_000
202 16#8000_0000#
203 3.14159_26535_89793_23846
204 @end example
205 @end itemize
207 @node Reserved Words,Comments,Numeric Literals,Lexical Elements
208 @anchor{gnat-style reserved-words}@anchor{7}
209 @section Reserved Words
213 @itemize *
215 @item 
216 Reserved words use all lower case.
218 @geindex Casing (for reserved words)
220 @example
221 return else
222 @end example
224 @item 
225 The words @code{Access}, @code{Delta} and @code{Digits} are
226 capitalized when used as attribute_designator.
227 @end itemize
229 @node Comments,,Reserved Words,Lexical Elements
230 @anchor{gnat-style comments}@anchor{8}
231 @section Comments
235 @itemize *
237 @item 
238 A comment starts with @code{--} followed by two spaces.
239 The only exception to this rule (i.e. one space is tolerated) is when the
240 comment ends with a single space followed by @code{--}.
241 It is also acceptable to have only one space between @code{--} and the start
242 of the comment when the comment is at the end of a line,
243 after some Ada code.
245 @item 
246 Every sentence in a comment should start with an upper-case letter (including
247 the first letter of the comment).
249 @geindex Casing (in comments)
251 @item 
252 When declarations are commented with ‘hanging’ comments, i.e.
253 comments after the declaration, there is no blank line before the
254 comment, and if it is absolutely necessary to have blank lines within
255 the comments, e.g. to make paragraph separations within a single comment,
256 these blank lines `do' have a @code{--} (unlike the
257 normal rule, which is to use entirely blank lines for separating
258 comment paragraphs).  The comment starts at same level of indentation
259 as code it is commenting.
261 @geindex Blank lines (in comments)
263 @geindex Indentation
265 @example
266 z : Integer;
267 --  Integer value for storing value of z
269 --  The previous line was a blank line.
270 @end example
272 @item 
273 Comments that are dubious or incomplete, or that comment on possibly
274 wrong or incomplete code, should be preceded or followed by @code{???}.
276 @item 
277 Comments in a subprogram body must generally be surrounded by blank lines.
278 An exception is a comment that follows a line containing a single keyword
279 ( @code{begin}, @code{else}, @code{loop} ):
281 @example
282 begin
283    --  Comment for the next statement
285    A := 5;
287    --  Comment for the B statement
289    B := 6;
290 end;
291 @end example
293 @item 
294 In sequences of statements, comments at the end of the lines should be
295 aligned.
297 @geindex Alignment (in comments)
299 @example
300 My_Identifier := 5;      --  First comment
301 Other_Id := 6;           --  Second comment
302 @end example
304 @item 
305 Short comments that fit on a single line are `not' ended with a
306 period.  Comments taking more than a line are punctuated in the normal
307 manner.
309 @item 
310 Comments should focus on `why' instead of `what'.
311 Descriptions of what subprograms do go with the specification.
313 @item 
314 Comments describing a subprogram spec should specifically mention the
315 formal argument names.  General rule: write a comment that does not
316 depend on the names of things.  The names are supplementary, not
317 sufficient, as comments.
319 @item 
320 `Do not' put two spaces after periods in comments.
321 @end itemize
323 @node Declarations and Types,Expressions and Names,Lexical Elements,Top
324 @anchor{gnat-style declarations-and-types}@anchor{9}
325 @chapter Declarations and Types
329 @itemize *
331 @item 
332 In entity declarations, colons must be surrounded by spaces.  Colons
333 should be aligned.
335 @geindex Alignment (in declarations)
337 @example
338 Entity1   : Integer;
339 My_Entity : Integer;
340 @end example
342 @item 
343 Declarations should be grouped in a logical order.
344 Related groups of declarations may be preceded by a header comment.
346 @item 
347 All local subprograms in a subprogram or package body should be declared
348 before the first local subprogram body.
350 @item 
351 Do not declare local entities that hide global entities.
353 @geindex Hiding of outer entities
355 @item 
356 Do not declare multiple variables in one declaration that spans lines.
357 Start a new declaration on each line, instead.
359 @item 
360 The defining_identifiers of global declarations serve as
361 comments of a sort.  So don’t choose terse names, but look for names
362 that give useful information instead.
364 @item 
365 Local names can be shorter, because they are used only within
366 one context, where comments explain their purpose.
368 @item 
369 When starting an initialization or default expression on the line that follows
370 the declaration line, use 2 characters for indentation.
372 @example
373 Entity1 : Integer :=
374   Function_Name (Parameters, For_Call);
375 @end example
377 @item 
378 If an initialization or default expression needs to be continued on subsequent
379 lines, the continuations should be indented from the start of the expression.
381 @example
382 Entity1 : Integer := Long_Function_Name
383                        (parameters for call);
384 @end example
385 @end itemize
387 @node Expressions and Names,Statements,Declarations and Types,Top
388 @anchor{gnat-style expressions-and-names}@anchor{a}
389 @chapter Expressions and Names
393 @itemize *
395 @item 
396 Every operator must be surrounded by spaces. An exception is that
397 this rule does not apply to the exponentiation operator, for which
398 there are no specific layout rules. The reason for this exception
399 is that sometimes it makes clearer reading to leave out the spaces
400 around exponentiation.
402 @geindex Operators
404 @example
405 E := A * B**2 + 3 * (C - D);
406 @end example
408 @item 
409 Use parentheses where they clarify the intended association of operands
410 with operators:
412 @geindex Parenthesization of expressions
414 @example
415 (A / B) * C
416 @end example
417 @end itemize
419 @node Statements,Subprograms,Expressions and Names,Top
420 @anchor{gnat-style statements}@anchor{b}
421 @chapter Statements
424 @menu
425 * Simple and Compound Statements:: 
426 * If Statements:: 
427 * Case Statements:: 
428 * Loop Statements:: 
429 * Block Statements:: 
431 @end menu
433 @node Simple and Compound Statements,If Statements,,Statements
434 @anchor{gnat-style simple-and-compound-statements}@anchor{c}
435 @section Simple and Compound Statements
439 @itemize *
441 @item 
442 Use only one statement or label per line.
444 @item 
445 A longer sequence_of_statements may be divided in logical
446 groups or separated from surrounding code using a blank line.
447 @end itemize
449 @node If Statements,Case Statements,Simple and Compound Statements,Statements
450 @anchor{gnat-style if-statements}@anchor{d}
451 @section If Statements
455 @itemize *
457 @item 
458 When the @code{if}, @code{elsif} or @code{else} keywords fit on the
459 same line with the condition and the @code{then} keyword, then the
460 statement is formatted as follows:
462 @geindex Alignment (in an if statement)
464 @example
465 if condition then
466    ...
467 elsif condition then
468    ...
469 else
470    ...
471 end if;
472 @end example
474 When the above layout is not possible, @code{then} should be aligned
475 with @code{if}, and conditions should preferably be split before an
476 @code{and} or @code{or} keyword a follows:
478 @example
479 if long_condition_that_has_to_be_split
480   and then continued_on_the_next_line
481 then
482    ...
483 end if;
484 @end example
486 The @code{elsif}, @code{else} and @code{end if} always line up with
487 the @code{if} keyword.  The preferred location for splitting the line
488 is before @code{and} or @code{or}.  The continuation of a condition is
489 indented with two spaces or as many as needed to make nesting clear.
490 As an exception, if conditions are closely related either of the
491 following is allowed:
493 @example
494 if x = lakdsjfhlkashfdlkflkdsalkhfsalkdhflkjdsahf
495      or else
496    x = asldkjhalkdsjfhhfd
497      or else
498    x = asdfadsfadsf
499 then
500   ...
501 end if;
503 if x = lakdsjfhlkashfdlkflkdsalkhfsalkdhflkjdsahf or else
504    x = asldkjhalkdsjfhhfd                         or else
505    x = asdfadsfadsf
506 then
507   ...
508 end if;
509 @end example
511 @item 
512 Conditions should use short-circuit forms ( @code{and then},
513 @code{or else} ), except when the operands are boolean variables
514 or boolean constants.
516 @geindex Short-circuit forms
518 @item 
519 Complex conditions in @code{if} statements are indented two characters:
521 @geindex Indentation (in if statements)
523 @example
524 if this_complex_condition
525   and then that_other_one
526   and then one_last_one
527 then
528    ...
529 end if;
530 @end example
532 There are some cases where complex conditionals can be laid out
533 in manners that do not follow these rules to preserve better
534 parallelism between branches, e.g.
536 @example
537 if xyz.abc (gef) = 'c'
538      or else
539    xyz.abc (gef) = 'x'
540 then
541    ...
542 end if;
543 @end example
545 @item 
546 Every @code{if} block is preceded and followed by a blank line, except
547 where it begins or ends a sequence_of_statements.
549 @geindex Blank lines (in an if statement)
551 @example
552 A := 5;
554 if A = 5 then
555    null;
556 end if;
558 A := 6;
559 @end example
560 @end itemize
562 @node Case Statements,Loop Statements,If Statements,Statements
563 @anchor{gnat-style case-statements}@anchor{e}
564 @section Case Statements
568 @itemize *
570 @item 
571 Layout is as below.  For long @code{case} statements, the extra indentation
572 can be saved by aligning the @code{when} clauses with the opening @code{case}.
574 @example
575 case expression is
576    when condition =>
577       ...
578    when condition =>
579       ...
580 end case;
581 @end example
582 @end itemize
584 @node Loop Statements,Block Statements,Case Statements,Statements
585 @anchor{gnat-style loop-statements}@anchor{f}
586 @section Loop Statements
590 @itemize *
592 @item 
593 When possible, have @code{for} or @code{while} on one line with the
594 condition and the @code{loop} keyword.
596 @example
597 for J in S'Range loop
598    ...
599 end loop;
600 @end example
602 If the condition is too long, split the condition (see ‘If
603 statements’ above) and align @code{loop} with the @code{for} or
604 @code{while} keyword.
606 @geindex Alignment (in a loop statement)
608 @example
609 while long_condition_that_has_to_be_split
610   and then continued_on_the_next_line
611 loop
612    ...
613 end loop;
614 @end example
616 If the loop_statement has an identifier, it is laid out as follows:
618 @example
619 Outer : while not condition loop
620    ...
621 end Outer;
622 @end example
623 @end itemize
625 @node Block Statements,,Loop Statements,Statements
626 @anchor{gnat-style block-statements}@anchor{10}
627 @section Block Statements
631 @itemize *
633 @item 
634 The @code{declare} (optional), @code{begin} and @code{end} words
635 are aligned, except when the block_statement is named.  There
636 is a blank line before the @code{begin} keyword:
638 @geindex Alignment (in a block statement)
640 @example
641 Some_Block : declare
642    ...
644 begin
645    ...
646 end Some_Block;
647 @end example
648 @end itemize
650 @node Subprograms,Packages and Visibility Rules,Statements,Top
651 @anchor{gnat-style subprograms}@anchor{11}
652 @chapter Subprograms
655 @menu
656 * Subprogram Declarations:: 
657 * Subprogram Bodies:: 
659 @end menu
661 @node Subprogram Declarations,Subprogram Bodies,,Subprograms
662 @anchor{gnat-style subprogram-declarations}@anchor{12}
663 @section Subprogram Declarations
667 @itemize *
669 @item 
670 Do not write the @code{in} for parameters.
672 @example
673 function Length (S : String) return Integer;
674 @end example
676 @item 
677 When the declaration line for a procedure or a function is too long to fit
678 the entire declaration (including the keyword procedure or function) on a
679 single line, then fold it, putting a single parameter on a line, aligning
680 the colons, as in:
682 @example
683 procedure Set_Heading
684   (Source : String;
685    Count  : Natural;
686    Pad    : Character := Space;
687    Fill   : Boolean   := True);
688 @end example
690 In the case of a function, if the entire spec does not fit on one line, then
691 the return may appear after the last parameter, as in:
693 @example
694 function Head
695   (Source : String;
696    Count  : Natural;
697    Pad    : Character := Space) return String;
698 @end example
700 Or it may appear on its own as a separate line. This form is preferred when
701 putting the return on the same line as the last parameter would result in
702 an overlong line. The return type may optionally be aligned with the types
703 of the parameters (usually we do this aligning if it results only in a small
704 number of extra spaces, and otherwise we don’t attempt to align). So two
705 alternative forms for the above spec are:
707 @example
708 function Head
709   (Source : String;
710    Count  : Natural;
711    Pad    : Character := Space)
712    return   String;
714 function Head
715   (Source : String;
716    Count  : Natural;
717    Pad    : Character := Space)
718    return String;
719 @end example
720 @end itemize
722 @node Subprogram Bodies,,Subprogram Declarations,Subprograms
723 @anchor{gnat-style subprogram-bodies}@anchor{13}
724 @section Subprogram Bodies
728 @itemize *
730 @item 
731 Function and procedure bodies should usually be sorted alphabetically. Do
732 not attempt to sort them in some logical order by functionality. For a
733 sequence of subprogram specs, a general alphabetical sorting is also
734 usually appropriate, but occasionally it makes sense to group by major
735 function, with appropriate headers.
737 @item 
738 All subprograms have a header giving the function name, with the following
739 format:
741 @example
742 -----------------
743 -- My_Function --
744 -----------------
746 procedure My_Function is
747 begin
748   ...
749 end My_Function;
750 @end example
752 Note that the name in the header is preceded by a single space,
753 not two spaces as for other comments. These headers are used on
754 nested subprograms as well as outer level subprograms. They may
755 also be used as headers for sections of comments, or collections
756 of declarations that are related.
758 @item 
759 Every subprogram body must have a preceding subprogram_declaration,
760 which includes proper client documentation so that you do not need to
761 read the subprogram body in order to understand what the subprogram does and
762 how to call it. All subprograms should be documented, without exceptions.
764 @geindex Blank lines (in subprogram bodies)
766 @item 
767 A sequence of declarations may optionally be separated from the following
768 begin by a blank line.  Just as we optionally allow blank lines in general
769 between declarations, this blank line should be present only if it improves
770 readability. Generally we avoid this blank line if the declarative part is
771 small (one or two lines) and the body has no blank lines, and we include it
772 if the declarative part is long or if the body has blank lines.
774 @item 
775 If the declarations in a subprogram contain at least one nested
776 subprogram body, then just before the @code{begin} of the enclosing
777 subprogram, there is a comment line and a blank line:
779 @example
780 --  Start of processing for Enclosing_Subprogram
782 begin
783   ...
784 end Enclosing_Subprogram;
785 @end example
787 @item 
788 When nested subprograms are present, variables that are referenced by any
789 nested subprogram should precede the nested subprogram specs. For variables
790 that are not referenced by nested procedures, the declarations can either also
791 be before any of the nested subprogram specs (this is the old style, more
792 generally used). Or then can come just before the begin, with a header. The
793 following example shows the two possible styles:
795 @example
796 procedure Style1 is
797    Var_Referenced_In_Nested      : Integer;
798    Var_Referenced_Only_In_Style1 : Integer;
800    proc Nested;
801    --  Comments ...
803    ------------
804    -- Nested --
805    ------------
807    procedure Nested is
808    begin
809       ...
810    end Nested;
812 --  Start of processing for Style1
814 begin
815    ...
816 end Style1;
818 procedure Style2 is
819    Var_Referenced_In_Nested : Integer;
821    proc Nested;
822    --  Comments ...
824    ------------
825    -- Nested --
826    ------------
828    procedure Nested is
829    begin
830       ...
831    end Nested;
833    --  Local variables
835    Var_Referenced_Only_In_Style2 : Integer;
837 --  Start of processing for Style2
839 begin
840    ...
841 end Style2;
842 @end example
844 For new code, we generally prefer Style2, but we do not insist on
845 modifying all legacy occurrences of Style1, which is still much
846 more common in the sources.
847 @end itemize
849 @node Packages and Visibility Rules,Program Structure and Compilation Issues,Subprograms,Top
850 @anchor{gnat-style packages-and-visibility-rules}@anchor{14}
851 @chapter Packages and Visibility Rules
855 @itemize *
857 @item 
858 All program units and subprograms have their name at the end:
860 @example
861 package P is
862    ...
863 end P;
864 @end example
866 @item 
867 We will use the style of @code{use} -ing @code{with} -ed packages, with
868 the context clauses looking like:
870 @geindex use clauses
872 @example
873 with A; use A;
874 with B; use B;
875 @end example
877 @item 
878 Names declared in the visible part of packages should be
879 unique, to prevent name clashes when the packages are @code{use} d.
881 @geindex Name clash avoidance
883 @example
884 package Entity is
885    type Entity_Kind is ...;
886    ...
887 end Entity;
888 @end example
890 @item 
891 After the file header comment, the context clause and unit specification
892 should be the first thing in a program_unit.
894 @item 
895 Preelaborate, Pure and Elaborate_Body pragmas should be added right after the
896 package name, indented an extra level and using the parameterless form:
898 @example
899 package Preelaborate_Package is
900    pragma Preelaborate;
901    ...
902 end Preelaborate_Package;
903 @end example
904 @end itemize
906 @node Program Structure and Compilation Issues,Index,Packages and Visibility Rules,Top
907 @anchor{gnat-style program-structure-and-compilation-issues}@anchor{15}
908 @chapter Program Structure and Compilation Issues
912 @itemize *
914 @item 
915 Every GNAT source file must be compiled with the @code{-gnatg}
916 switch to check the coding style.
917 (Note that you should look at
918 style.adb to see the lexical rules enforced by @code{-gnatg} ).
920 @geindex -gnatg option (to gcc)
922 @geindex style.adb file
924 @item 
925 Each source file should contain only one compilation unit.
927 @item 
928 Filenames should be 8 or fewer characters, followed by the @code{.adb}
929 extension for a body or @code{.ads} for a spec.
931 @geindex File name length
933 @item 
934 Unit names should be distinct when ‘krunch’ed to 8 characters
935 (see krunch.ads) and the filenames should match the unit name,
936 except that they are all lower case.
938 @geindex krunch.ads file
939 @end itemize
941 @menu
942 * GNU Free Documentation License:: 
944 @end menu
946 @node GNU Free Documentation License,,,Program Structure and Compilation Issues
947 @anchor{share/gnu_free_documentation_license doc}@anchor{16}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{17}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{18}
948 @section GNU Free Documentation License
951 Version 1.3, 3 November 2008
953 Copyright  2000, 2001, 2002, 2007, 2008  Free Software Foundation, Inc
954 @indicateurl{https://fsf.org/}
956 Everyone is permitted to copy and distribute verbatim copies of this
957 license document, but changing it is not allowed.
959 `Preamble'
961 The purpose of this License is to make a manual, textbook, or other
962 functional and useful document “free” in the sense of freedom: to
963 assure everyone the effective freedom to copy and redistribute it,
964 with or without modifying it, either commercially or noncommercially.
965 Secondarily, this License preserves for the author and publisher a way
966 to get credit for their work, while not being considered responsible
967 for modifications made by others.
969 This License is a kind of “copyleft”, which means that derivative
970 works of the document must themselves be free in the same sense.  It
971 complements the GNU General Public License, which is a copyleft
972 license designed for free software.
974 We have designed this License in order to use it for manuals for free
975 software, because free software needs free documentation: a free
976 program should come with manuals providing the same freedoms that the
977 software does.  But this License is not limited to software manuals;
978 it can be used for any textual work, regardless of subject matter or
979 whether it is published as a printed book.  We recommend this License
980 principally for works whose purpose is instruction or reference.
982 `1. APPLICABILITY AND DEFINITIONS'
984 This License applies to any manual or other work, in any medium, that
985 contains a notice placed by the copyright holder saying it can be
986 distributed under the terms of this License.  Such a notice grants a
987 world-wide, royalty-free license, unlimited in duration, to use that
988 work under the conditions stated herein.  The `Document', below,
989 refers to any such manual or work.  Any member of the public is a
990 licensee, and is addressed as “`you'”.  You accept the license if you
991 copy, modify or distribute the work in a way requiring permission
992 under copyright law.
994 A “`Modified Version'” of the Document means any work containing the
995 Document or a portion of it, either copied verbatim, or with
996 modifications and/or translated into another language.
998 A “`Secondary Section'” is a named appendix or a front-matter section of
999 the Document that deals exclusively with the relationship of the
1000 publishers or authors of the Document to the Document’s overall subject
1001 (or to related matters) and contains nothing that could fall directly
1002 within that overall subject.  (Thus, if the Document is in part a
1003 textbook of mathematics, a Secondary Section may not explain any
1004 mathematics.)  The relationship could be a matter of historical
1005 connection with the subject or with related matters, or of legal,
1006 commercial, philosophical, ethical or political position regarding
1007 them.
1009 The “`Invariant Sections'” are certain Secondary Sections whose titles
1010 are designated, as being those of Invariant Sections, in the notice
1011 that says that the Document is released under this License.  If a
1012 section does not fit the above definition of Secondary then it is not
1013 allowed to be designated as Invariant.  The Document may contain zero
1014 Invariant Sections.  If the Document does not identify any Invariant
1015 Sections then there are none.
1017 The “`Cover Texts'” are certain short passages of text that are listed,
1018 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
1019 the Document is released under this License.  A Front-Cover Text may
1020 be at most 5 words, and a Back-Cover Text may be at most 25 words.
1022 A “`Transparent'” copy of the Document means a machine-readable copy,
1023 represented in a format whose specification is available to the
1024 general public, that is suitable for revising the document
1025 straightforwardly with generic text editors or (for images composed of
1026 pixels) generic paint programs or (for drawings) some widely available
1027 drawing editor, and that is suitable for input to text formatters or
1028 for automatic translation to a variety of formats suitable for input
1029 to text formatters.  A copy made in an otherwise Transparent file
1030 format whose markup, or absence of markup, has been arranged to thwart
1031 or discourage subsequent modification by readers is not Transparent.
1032 An image format is not Transparent if used for any substantial amount
1033 of text.  A copy that is not “Transparent” is called `Opaque'.
1035 Examples of suitable formats for Transparent copies include plain
1036 ASCII without markup, Texinfo input format, LaTeX input format, SGML
1037 or XML using a publicly available DTD, and standard-conforming simple
1038 HTML, PostScript or PDF designed for human modification.  Examples of
1039 transparent image formats include PNG, XCF and JPG.  Opaque formats
1040 include proprietary formats that can be read and edited only by
1041 proprietary word processors, SGML or XML for which the DTD and/or
1042 processing tools are not generally available, and the
1043 machine-generated HTML, PostScript or PDF produced by some word
1044 processors for output purposes only.
1046 The “`Title Page'” means, for a printed book, the title page itself,
1047 plus such following pages as are needed to hold, legibly, the material
1048 this License requires to appear in the title page.  For works in
1049 formats which do not have any title page as such, “Title Page” means
1050 the text near the most prominent appearance of the work’s title,
1051 preceding the beginning of the body of the text.
1053 The “`publisher'” means any person or entity that distributes
1054 copies of the Document to the public.
1056 A section “`Entitled XYZ'” means a named subunit of the Document whose
1057 title either is precisely XYZ or contains XYZ in parentheses following
1058 text that translates XYZ in another language.  (Here XYZ stands for a
1059 specific section name mentioned below, such as “`Acknowledgements'”,
1060 “`Dedications'”, “`Endorsements'”, or “`History'”.)
1061 To “`Preserve the Title'”
1062 of such a section when you modify the Document means that it remains a
1063 section “Entitled XYZ” according to this definition.
1065 The Document may include Warranty Disclaimers next to the notice which
1066 states that this License applies to the Document.  These Warranty
1067 Disclaimers are considered to be included by reference in this
1068 License, but only as regards disclaiming warranties: any other
1069 implication that these Warranty Disclaimers may have is void and has
1070 no effect on the meaning of this License.
1072 `2. VERBATIM COPYING'
1074 You may copy and distribute the Document in any medium, either
1075 commercially or noncommercially, provided that this License, the
1076 copyright notices, and the license notice saying this License applies
1077 to the Document are reproduced in all copies, and that you add no other
1078 conditions whatsoever to those of this License.  You may not use
1079 technical measures to obstruct or control the reading or further
1080 copying of the copies you make or distribute.  However, you may accept
1081 compensation in exchange for copies.  If you distribute a large enough
1082 number of copies you must also follow the conditions in section 3.
1084 You may also lend copies, under the same conditions stated above, and
1085 you may publicly display copies.
1087 `3. COPYING IN QUANTITY'
1089 If you publish printed copies (or copies in media that commonly have
1090 printed covers) of the Document, numbering more than 100, and the
1091 Document’s license notice requires Cover Texts, you must enclose the
1092 copies in covers that carry, clearly and legibly, all these Cover
1093 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
1094 the back cover.  Both covers must also clearly and legibly identify
1095 you as the publisher of these copies.  The front cover must present
1096 the full title with all words of the title equally prominent and
1097 visible.  You may add other material on the covers in addition.
1098 Copying with changes limited to the covers, as long as they preserve
1099 the title of the Document and satisfy these conditions, can be treated
1100 as verbatim copying in other respects.
1102 If the required texts for either cover are too voluminous to fit
1103 legibly, you should put the first ones listed (as many as fit
1104 reasonably) on the actual cover, and continue the rest onto adjacent
1105 pages.
1107 If you publish or distribute Opaque copies of the Document numbering
1108 more than 100, you must either include a machine-readable Transparent
1109 copy along with each Opaque copy, or state in or with each Opaque copy
1110 a computer-network location from which the general network-using
1111 public has access to download using public-standard network protocols
1112 a complete Transparent copy of the Document, free of added material.
1113 If you use the latter option, you must take reasonably prudent steps,
1114 when you begin distribution of Opaque copies in quantity, to ensure
1115 that this Transparent copy will remain thus accessible at the stated
1116 location until at least one year after the last time you distribute an
1117 Opaque copy (directly or through your agents or retailers) of that
1118 edition to the public.
1120 It is requested, but not required, that you contact the authors of the
1121 Document well before redistributing any large number of copies, to give
1122 them a chance to provide you with an updated version of the Document.
1124 `4. MODIFICATIONS'
1126 You may copy and distribute a Modified Version of the Document under
1127 the conditions of sections 2 and 3 above, provided that you release
1128 the Modified Version under precisely this License, with the Modified
1129 Version filling the role of the Document, thus licensing distribution
1130 and modification of the Modified Version to whoever possesses a copy
1131 of it.  In addition, you must do these things in the Modified Version:
1134 @enumerate A
1136 @item 
1137 Use in the Title Page (and on the covers, if any) a title distinct
1138 from that of the Document, and from those of previous versions
1139 (which should, if there were any, be listed in the History section
1140 of the Document).  You may use the same title as a previous version
1141 if the original publisher of that version gives permission.
1143 @item 
1144 List on the Title Page, as authors, one or more persons or entities
1145 responsible for authorship of the modifications in the Modified
1146 Version, together with at least five of the principal authors of the
1147 Document (all of its principal authors, if it has fewer than five),
1148 unless they release you from this requirement.
1150 @item 
1151 State on the Title page the name of the publisher of the
1152 Modified Version, as the publisher.
1154 @item 
1155 Preserve all the copyright notices of the Document.
1157 @item 
1158 Add an appropriate copyright notice for your modifications
1159 adjacent to the other copyright notices.
1161 @item 
1162 Include, immediately after the copyright notices, a license notice
1163 giving the public permission to use the Modified Version under the
1164 terms of this License, in the form shown in the Addendum below.
1166 @item 
1167 Preserve in that license notice the full lists of Invariant Sections
1168 and required Cover Texts given in the Document’s license notice.
1170 @item 
1171 Include an unaltered copy of this License.
1173 @item 
1174 Preserve the section Entitled “History”, Preserve its Title, and add
1175 to it an item stating at least the title, year, new authors, and
1176 publisher of the Modified Version as given on the Title Page.  If
1177 there is no section Entitled “History” in the Document, create one
1178 stating the title, year, authors, and publisher of the Document as
1179 given on its Title Page, then add an item describing the Modified
1180 Version as stated in the previous sentence.
1182 @item 
1183 Preserve the network location, if any, given in the Document for
1184 public access to a Transparent copy of the Document, and likewise
1185 the network locations given in the Document for previous versions
1186 it was based on.  These may be placed in the “History” section.
1187 You may omit a network location for a work that was published at
1188 least four years before the Document itself, or if the original
1189 publisher of the version it refers to gives permission.
1191 @item 
1192 For any section Entitled “Acknowledgements” or “Dedications”,
1193 Preserve the Title of the section, and preserve in the section all
1194 the substance and tone of each of the contributor acknowledgements
1195 and/or dedications given therein.
1197 @item 
1198 Preserve all the Invariant Sections of the Document,
1199 unaltered in their text and in their titles.  Section numbers
1200 or the equivalent are not considered part of the section titles.
1202 @item 
1203 Delete any section Entitled “Endorsements”.  Such a section
1204 may not be included in the Modified Version.
1206 @item 
1207 Do not retitle any existing section to be Entitled “Endorsements”
1208 or to conflict in title with any Invariant Section.
1210 @item 
1211 Preserve any Warranty Disclaimers.
1212 @end enumerate
1214 If the Modified Version includes new front-matter sections or
1215 appendices that qualify as Secondary Sections and contain no material
1216 copied from the Document, you may at your option designate some or all
1217 of these sections as invariant.  To do this, add their titles to the
1218 list of Invariant Sections in the Modified Version’s license notice.
1219 These titles must be distinct from any other section titles.
1221 You may add a section Entitled “Endorsements”, provided it contains
1222 nothing but endorsements of your Modified Version by various
1223 parties—for example, statements of peer review or that the text has
1224 been approved by an organization as the authoritative definition of a
1225 standard.
1227 You may add a passage of up to five words as a Front-Cover Text, and a
1228 passage of up to 25 words as a Back-Cover Text, to the end of the list
1229 of Cover Texts in the Modified Version.  Only one passage of
1230 Front-Cover Text and one of Back-Cover Text may be added by (or
1231 through arrangements made by) any one entity.  If the Document already
1232 includes a cover text for the same cover, previously added by you or
1233 by arrangement made by the same entity you are acting on behalf of,
1234 you may not add another; but you may replace the old one, on explicit
1235 permission from the previous publisher that added the old one.
1237 The author(s) and publisher(s) of the Document do not by this License
1238 give permission to use their names for publicity for or to assert or
1239 imply endorsement of any Modified Version.
1241 `5. COMBINING DOCUMENTS'
1243 You may combine the Document with other documents released under this
1244 License, under the terms defined in section 4 above for modified
1245 versions, provided that you include in the combination all of the
1246 Invariant Sections of all of the original documents, unmodified, and
1247 list them all as Invariant Sections of your combined work in its
1248 license notice, and that you preserve all their Warranty Disclaimers.
1250 The combined work need only contain one copy of this License, and
1251 multiple identical Invariant Sections may be replaced with a single
1252 copy.  If there are multiple Invariant Sections with the same name but
1253 different contents, make the title of each such section unique by
1254 adding at the end of it, in parentheses, the name of the original
1255 author or publisher of that section if known, or else a unique number.
1256 Make the same adjustment to the section titles in the list of
1257 Invariant Sections in the license notice of the combined work.
1259 In the combination, you must combine any sections Entitled “History”
1260 in the various original documents, forming one section Entitled
1261 “History”; likewise combine any sections Entitled “Acknowledgements”,
1262 and any sections Entitled “Dedications”.  You must delete all sections
1263 Entitled “Endorsements”.
1265 `6. COLLECTIONS OF DOCUMENTS'
1267 You may make a collection consisting of the Document and other documents
1268 released under this License, and replace the individual copies of this
1269 License in the various documents with a single copy that is included in
1270 the collection, provided that you follow the rules of this License for
1271 verbatim copying of each of the documents in all other respects.
1273 You may extract a single document from such a collection, and distribute
1274 it individually under this License, provided you insert a copy of this
1275 License into the extracted document, and follow this License in all
1276 other respects regarding verbatim copying of that document.
1278 `7. AGGREGATION WITH INDEPENDENT WORKS'
1280 A compilation of the Document or its derivatives with other separate
1281 and independent documents or works, in or on a volume of a storage or
1282 distribution medium, is called an “aggregate” if the copyright
1283 resulting from the compilation is not used to limit the legal rights
1284 of the compilation’s users beyond what the individual works permit.
1285 When the Document is included in an aggregate, this License does not
1286 apply to the other works in the aggregate which are not themselves
1287 derivative works of the Document.
1289 If the Cover Text requirement of section 3 is applicable to these
1290 copies of the Document, then if the Document is less than one half of
1291 the entire aggregate, the Document’s Cover Texts may be placed on
1292 covers that bracket the Document within the aggregate, or the
1293 electronic equivalent of covers if the Document is in electronic form.
1294 Otherwise they must appear on printed covers that bracket the whole
1295 aggregate.
1297 `8. TRANSLATION'
1299 Translation is considered a kind of modification, so you may
1300 distribute translations of the Document under the terms of section 4.
1301 Replacing Invariant Sections with translations requires special
1302 permission from their copyright holders, but you may include
1303 translations of some or all Invariant Sections in addition to the
1304 original versions of these Invariant Sections.  You may include a
1305 translation of this License, and all the license notices in the
1306 Document, and any Warranty Disclaimers, provided that you also include
1307 the original English version of this License and the original versions
1308 of those notices and disclaimers.  In case of a disagreement between
1309 the translation and the original version of this License or a notice
1310 or disclaimer, the original version will prevail.
1312 If a section in the Document is Entitled “Acknowledgements”,
1313 “Dedications”, or “History”, the requirement (section 4) to Preserve
1314 its Title (section 1) will typically require changing the actual
1315 title.
1317 `9. TERMINATION'
1319 You may not copy, modify, sublicense, or distribute the Document
1320 except as expressly provided under this License.  Any attempt
1321 otherwise to copy, modify, sublicense, or distribute it is void, and
1322 will automatically terminate your rights under this License.
1324 However, if you cease all violation of this License, then your license
1325 from a particular copyright holder is reinstated (a) provisionally,
1326 unless and until the copyright holder explicitly and finally
1327 terminates your license, and (b) permanently, if the copyright holder
1328 fails to notify you of the violation by some reasonable means prior to
1329 60 days after the cessation.
1331 Moreover, your license from a particular copyright holder is
1332 reinstated permanently if the copyright holder notifies you of the
1333 violation by some reasonable means, this is the first time you have
1334 received notice of violation of this License (for any work) from that
1335 copyright holder, and you cure the violation prior to 30 days after
1336 your receipt of the notice.
1338 Termination of your rights under this section does not terminate the
1339 licenses of parties who have received copies or rights from you under
1340 this License.  If your rights have been terminated and not permanently
1341 reinstated, receipt of a copy of some or all of the same material does
1342 not give you any rights to use it.
1344 `10. FUTURE REVISIONS OF THIS LICENSE'
1346 The Free Software Foundation may publish new, revised versions
1347 of the GNU Free Documentation License from time to time.  Such new
1348 versions will be similar in spirit to the present version, but may
1349 differ in detail to address new problems or concerns.  See
1350 @indicateurl{https://www.gnu.org/copyleft/}.
1352 Each version of the License is given a distinguishing version number.
1353 If the Document specifies that a particular numbered version of this
1354 License “or any later version” applies to it, you have the option of
1355 following the terms and conditions either of that specified version or
1356 of any later version that has been published (not as a draft) by the
1357 Free Software Foundation.  If the Document does not specify a version
1358 number of this License, you may choose any version ever published (not
1359 as a draft) by the Free Software Foundation.  If the Document
1360 specifies that a proxy can decide which future versions of this
1361 License can be used, that proxy’s public statement of acceptance of a
1362 version permanently authorizes you to choose that version for the
1363 Document.
1365 `11. RELICENSING'
1367 “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any
1368 World Wide Web server that publishes copyrightable works and also
1369 provides prominent facilities for anybody to edit those works.  A
1370 public wiki that anybody can edit is an example of such a server.  A
1371 “Massive Multiauthor Collaboration” (or “MMC”) contained in the
1372 site means any set of copyrightable works thus published on the MMC
1373 site.
1375 “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0
1376 license published by Creative Commons Corporation, a not-for-profit
1377 corporation with a principal place of business in San Francisco,
1378 California, as well as future copyleft versions of that license
1379 published by that same organization.
1381 “Incorporate” means to publish or republish a Document, in whole or
1382 in part, as part of another Document.
1384 An MMC is “eligible for relicensing” if it is licensed under this
1385 License, and if all works that were first published under this License
1386 somewhere other than this MMC, and subsequently incorporated in whole
1387 or in part into the MMC, (1) had no cover texts or invariant sections,
1388 and (2) were thus incorporated prior to November 1, 2008.
1390 The operator of an MMC Site may republish an MMC contained in the site
1391 under CC-BY-SA on the same site at any time before August 1, 2009,
1392 provided the MMC is eligible for relicensing.
1394 `ADDENDUM: How to use this License for your documents'
1396 To use this License in a document you have written, include a copy of
1397 the License in the document and put the following copyright and
1398 license notices just after the title page:
1400 @quotation
1402 Copyright © YEAR  YOUR NAME.
1403 Permission is granted to copy, distribute and/or modify this document
1404 under the terms of the GNU Free Documentation License, Version 1.3
1405 or any later version published by the Free Software Foundation;
1406 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
1407 A copy of the license is included in the section entitled “GNU
1408 Free Documentation License”.
1409 @end quotation
1411 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
1412 replace the “with … Texts.” line with this:
1414 @quotation
1416 with the Invariant Sections being LIST THEIR TITLES, with the
1417 Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
1418 @end quotation
1420 If you have Invariant Sections without Cover Texts, or some other
1421 combination of the three, merge those two alternatives to suit the
1422 situation.
1424 If your document contains nontrivial examples of program code, we
1425 recommend releasing these examples in parallel under your choice of
1426 free software license, such as the GNU General Public License,
1427 to permit their use in free software.
1429 @node Index,,Program Structure and Compilation Issues,Top
1430 @unnumbered Index
1433 @printindex ge
1436 @c %**end of body
1437 @bye