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