Home | History | Annotate | Line # | Download | only in doc
      1  1.1  mrg This is gnat-style.info, produced by makeinfo version 6.5 from
      2  1.1  mrg gnat-style.texi.
      3  1.1  mrg 
      4  1.1  mrg      GNAT Coding Style: A Guide for GNAT Developers , Jan 03, 2022
      5  1.1  mrg 
      6  1.1  mrg      AdaCore
      7  1.1  mrg 
      8  1.1  mrg      Copyright  2008-2022, Free Software Foundation
      9  1.1  mrg 
     10  1.1  mrg INFO-DIR-SECTION GNU Ada Tools
     11  1.1  mrg START-INFO-DIR-ENTRY
     12  1.1  mrg * gnat-style: (gnat-style.info). gnat-style
     13  1.1  mrg END-INFO-DIR-ENTRY
     14  1.1  mrg 
     15  1.1  mrg 
     16  1.1  mrg    Generated by Sphinx 4.3.1.
     17  1.1  mrg 
     18  1.1  mrg 
     19  1.1  mrg File: gnat-style.info,  Node: Top,  Next: General,  Up: (dir)
     20  1.1  mrg 
     21  1.1  mrg GNAT Coding Style A Guide for GNAT Developers
     22  1.1  mrg *********************************************
     23  1.1  mrg 
     24  1.1  mrg      GNAT Coding Style: A Guide for GNAT Developers , Jan 03, 2022
     25  1.1  mrg 
     26  1.1  mrg      AdaCore
     27  1.1  mrg 
     28  1.1  mrg      Copyright  2008-2022, Free Software Foundation
     29  1.1  mrg 
     30  1.1  mrg * Menu:
     31  1.1  mrg 
     32  1.1  mrg * General::
     33  1.1  mrg * Lexical Elements::
     34  1.1  mrg * Declarations and Types::
     35  1.1  mrg * Expressions and Names::
     36  1.1  mrg * Statements::
     37  1.1  mrg * Subprograms::
     38  1.1  mrg * Packages and Visibility Rules::
     39  1.1  mrg * Program Structure and Compilation Issues::
     40  1.1  mrg * Index::
     41  1.1  mrg 
     42  1.1  mrg 
     43  1.1  mrg File: gnat-style.info,  Node: General,  Next: Lexical Elements,  Prev: Top,  Up: Top
     44  1.1  mrg 
     45  1.1  mrg 1 General
     46  1.1  mrg *********
     47  1.1  mrg 
     48  1.1  mrg Most of GNAT is written in Ada using a consistent style to ensure
     49  1.1  mrg readability of the code.  This document has been written to help
     50  1.1  mrg maintain this consistent style, while having a large group of developers
     51  1.1  mrg work on the compiler.
     52  1.1  mrg 
     53  1.1  mrg For the coding style in the C parts of the compiler and run time, see
     54  1.1  mrg the GNU Coding Guidelines.
     55  1.1  mrg 
     56  1.1  mrg This document is structured after the Ada Reference Manual.  Those
     57  1.1  mrg familiar with that document should be able to quickly lookup style rules
     58  1.1  mrg for particular constructs.
     59  1.1  mrg 
     60  1.1  mrg 
     61  1.1  mrg File: gnat-style.info,  Node: Lexical Elements,  Next: Declarations and Types,  Prev: General,  Up: Top
     62  1.1  mrg 
     63  1.1  mrg 2 Lexical Elements
     64  1.1  mrg ******************
     65  1.1  mrg 
     66  1.1  mrg * Menu:
     67  1.1  mrg 
     68  1.1  mrg * Character Set and Separators::
     69  1.1  mrg * Identifiers::
     70  1.1  mrg * Numeric Literals::
     71  1.1  mrg * Reserved Words::
     72  1.1  mrg * Comments::
     73  1.1  mrg 
     74  1.1  mrg 
     75  1.1  mrg File: gnat-style.info,  Node: Character Set and Separators,  Next: Identifiers,  Up: Lexical Elements
     76  1.1  mrg 
     77  1.1  mrg 2.1 Character Set and Separators
     78  1.1  mrg ================================
     79  1.1  mrg 
     80  1.1  mrg    * The character set used should be plain 7-bit ASCII. The only
     81  1.1  mrg      separators allowed are space and the end-of-line sequence.  No
     82  1.1  mrg      other control character or format effector (such as HT, VT,
     83  1.1  mrg      FF ) should be used.  The normal end-of-line sequence is used,
     84  1.1  mrg      which may be LF, CR/LF or CR, depending on the host system.
     85  1.1  mrg      An optional SUB ( 16#1A# ) may be present as the last character
     86  1.1  mrg      in the file on hosts using that character as file terminator.
     87  1.1  mrg 
     88  1.1  mrg    * Files that are checked in or distributed should be in host format.
     89  1.1  mrg 
     90  1.1  mrg    * A line should never be longer than 79 characters, not counting the
     91  1.1  mrg      line separator.
     92  1.1  mrg 
     93  1.1  mrg    * Lines must not have trailing blanks.
     94  1.1  mrg 
     95  1.1  mrg    * Indentation is 3 characters per level for if statements, loops,
     96  1.1  mrg      and case statements.  For exact information on required spacing
     97  1.1  mrg      between lexical elements, see file style.adb.
     98  1.1  mrg 
     99  1.1  mrg 
    100  1.1  mrg File: gnat-style.info,  Node: Identifiers,  Next: Numeric Literals,  Prev: Character Set and Separators,  Up: Lexical Elements
    101  1.1  mrg 
    102  1.1  mrg 2.2 Identifiers
    103  1.1  mrg ===============
    104  1.1  mrg 
    105  1.1  mrg    * Identifiers will start with an upper case letter, and each letter
    106  1.1  mrg      following an underscore will be upper case.
    107  1.1  mrg 
    108  1.1  mrg      Short acronyms may be all upper case.  All other letters are lower
    109  1.1  mrg      case.  An exception is for identifiers matching a foreign language.
    110  1.1  mrg      In particular, we use all lower case where appropriate for C.
    111  1.1  mrg 
    112  1.1  mrg    * Use underscores to separate words in an identifier.
    113  1.1  mrg 
    114  1.1  mrg    * Try to limit your use of abbreviations in identifiers.  It is ok to
    115  1.1  mrg      make a few abbreviations, explain what they mean, and then use them
    116  1.1  mrg      frequently, but dont use lots of obscure abbreviations.  An
    117  1.1  mrg      example is the ALI word which stands for Ada Library Information
    118  1.1  mrg      and is by convention always written in upper-case when used in
    119  1.1  mrg      entity names.
    120  1.1  mrg 
    121  1.1  mrg           procedure Find_ALI_Files;
    122  1.1  mrg 
    123  1.1  mrg    * Dont use the variable name I, use J instead; I is too easily
    124  1.1  mrg      confused with 1 in some fonts.  Similarly dont use the variable
    125  1.1  mrg      O, which is too easily mistaken for the number 0.
    126  1.1  mrg 
    127  1.1  mrg 
    128  1.1  mrg File: gnat-style.info,  Node: Numeric Literals,  Next: Reserved Words,  Prev: Identifiers,  Up: Lexical Elements
    129  1.1  mrg 
    130  1.1  mrg 2.3 Numeric Literals
    131  1.1  mrg ====================
    132  1.1  mrg 
    133  1.1  mrg    * Numeric literals should include underscores where helpful for
    134  1.1  mrg      readability.
    135  1.1  mrg 
    136  1.1  mrg           1_000_000
    137  1.1  mrg           16#8000_0000#
    138  1.1  mrg           3.14159_26535_89793_23846
    139  1.1  mrg 
    140  1.1  mrg 
    141  1.1  mrg File: gnat-style.info,  Node: Reserved Words,  Next: Comments,  Prev: Numeric Literals,  Up: Lexical Elements
    142  1.1  mrg 
    143  1.1  mrg 2.4 Reserved Words
    144  1.1  mrg ==================
    145  1.1  mrg 
    146  1.1  mrg    * Reserved words use all lower case.
    147  1.1  mrg 
    148  1.1  mrg           return else
    149  1.1  mrg 
    150  1.1  mrg    * The words Access, Delta and Digits are capitalized when used
    151  1.1  mrg      as attribute_designator.
    152  1.1  mrg 
    153  1.1  mrg 
    154  1.1  mrg File: gnat-style.info,  Node: Comments,  Prev: Reserved Words,  Up: Lexical Elements
    155  1.1  mrg 
    156  1.1  mrg 2.5 Comments
    157  1.1  mrg ============
    158  1.1  mrg 
    159  1.1  mrg    * A comment starts with -- followed by two spaces.  The only
    160  1.1  mrg      exception to this rule (i.e.  one space is tolerated) is when the
    161  1.1  mrg      comment ends with a single space followed by --.  It is also
    162  1.1  mrg      acceptable to have only one space between -- and the start of the
    163  1.1  mrg      comment when the comment is at the end of a line, after some Ada
    164  1.1  mrg      code.
    165  1.1  mrg 
    166  1.1  mrg    * Every sentence in a comment should start with an upper-case letter
    167  1.1  mrg      (including the first letter of the comment).
    168  1.1  mrg 
    169  1.1  mrg    * When declarations are commented with hanging comments, i.e.
    170  1.1  mrg      comments after the declaration, there is no blank line before the
    171  1.1  mrg      comment, and if it is absolutely necessary to have blank lines
    172  1.1  mrg      within the comments, e.g.  to make paragraph separations within a
    173  1.1  mrg      single comment, these blank lines `do' have a -- (unlike the
    174  1.1  mrg      normal rule, which is to use entirely blank lines for separating
    175  1.1  mrg      comment paragraphs).  The comment starts at same level of
    176  1.1  mrg      indentation as code it is commenting.
    177  1.1  mrg 
    178  1.1  mrg           z : Integer;
    179  1.1  mrg           --  Integer value for storing value of z
    180  1.1  mrg           --
    181  1.1  mrg           --  The previous line was a blank line.
    182  1.1  mrg 
    183  1.1  mrg    * Comments that are dubious or incomplete, or that comment on
    184  1.1  mrg      possibly wrong or incomplete code, should be preceded or followed
    185  1.1  mrg      by ???.
    186  1.1  mrg 
    187  1.1  mrg    * Comments in a subprogram body must generally be surrounded by blank
    188  1.1  mrg      lines.  An exception is a comment that follows a line containing a
    189  1.1  mrg      single keyword ( begin, else, loop ):
    190  1.1  mrg 
    191  1.1  mrg           begin
    192  1.1  mrg              --  Comment for the next statement
    193  1.1  mrg 
    194  1.1  mrg              A := 5;
    195  1.1  mrg 
    196  1.1  mrg              --  Comment for the B statement
    197  1.1  mrg 
    198  1.1  mrg              B := 6;
    199  1.1  mrg           end;
    200  1.1  mrg 
    201  1.1  mrg    * In sequences of statements, comments at the end of the lines should
    202  1.1  mrg      be aligned.
    203  1.1  mrg 
    204  1.1  mrg           My_Identifier := 5;      --  First comment
    205  1.1  mrg           Other_Id := 6;           --  Second comment
    206  1.1  mrg 
    207  1.1  mrg    * Short comments that fit on a single line are `not' ended with a
    208  1.1  mrg      period.  Comments taking more than a line are punctuated in the
    209  1.1  mrg      normal manner.
    210  1.1  mrg 
    211  1.1  mrg    * Comments should focus on `why' instead of `what'.  Descriptions of
    212  1.1  mrg      what subprograms do go with the specification.
    213  1.1  mrg 
    214  1.1  mrg    * Comments describing a subprogram spec should specifically mention
    215  1.1  mrg      the formal argument names.  General rule: write a comment that does
    216  1.1  mrg      not depend on the names of things.  The names are supplementary,
    217  1.1  mrg      not sufficient, as comments.
    218  1.1  mrg 
    219  1.1  mrg    * `Do not' put two spaces after periods in comments.
    220  1.1  mrg 
    221  1.1  mrg 
    222  1.1  mrg File: gnat-style.info,  Node: Declarations and Types,  Next: Expressions and Names,  Prev: Lexical Elements,  Up: Top
    223  1.1  mrg 
    224  1.1  mrg 3 Declarations and Types
    225  1.1  mrg ************************
    226  1.1  mrg 
    227  1.1  mrg    * In entity declarations, colons must be surrounded by spaces.
    228  1.1  mrg      Colons should be aligned.
    229  1.1  mrg 
    230  1.1  mrg           Entity1   : Integer;
    231  1.1  mrg           My_Entity : Integer;
    232  1.1  mrg 
    233  1.1  mrg    * Declarations should be grouped in a logical order.  Related groups
    234  1.1  mrg      of declarations may be preceded by a header comment.
    235  1.1  mrg 
    236  1.1  mrg    * All local subprograms in a subprogram or package body should be
    237  1.1  mrg      declared before the first local subprogram body.
    238  1.1  mrg 
    239  1.1  mrg    * Do not declare local entities that hide global entities.
    240  1.1  mrg 
    241  1.1  mrg    * Do not declare multiple variables in one declaration that spans
    242  1.1  mrg      lines.  Start a new declaration on each line, instead.
    243  1.1  mrg 
    244  1.1  mrg    * The defining_identifiers of global declarations serve as comments
    245  1.1  mrg      of a sort.  So dont choose terse names, but look for names that
    246  1.1  mrg      give useful information instead.
    247  1.1  mrg 
    248  1.1  mrg    * Local names can be shorter, because they are used only within one
    249  1.1  mrg      context, where comments explain their purpose.
    250  1.1  mrg 
    251  1.1  mrg    * When starting an initialization or default expression on the line
    252  1.1  mrg      that follows the declaration line, use 2 characters for
    253  1.1  mrg      indentation.
    254  1.1  mrg 
    255  1.1  mrg           Entity1 : Integer :=
    256  1.1  mrg             Function_Name (Parameters, For_Call);
    257  1.1  mrg 
    258  1.1  mrg    * If an initialization or default expression needs to be continued on
    259  1.1  mrg      subsequent lines, the continuations should be indented from the
    260  1.1  mrg      start of the expression.
    261  1.1  mrg 
    262  1.1  mrg           Entity1 : Integer := Long_Function_Name
    263  1.1  mrg                                  (parameters for call);
    264  1.1  mrg 
    265  1.1  mrg 
    266  1.1  mrg File: gnat-style.info,  Node: Expressions and Names,  Next: Statements,  Prev: Declarations and Types,  Up: Top
    267  1.1  mrg 
    268  1.1  mrg 4 Expressions and Names
    269  1.1  mrg ***********************
    270  1.1  mrg 
    271  1.1  mrg    * Every operator must be surrounded by spaces.  An exception is that
    272  1.1  mrg      this rule does not apply to the exponentiation operator, for which
    273  1.1  mrg      there are no specific layout rules.  The reason for this exception
    274  1.1  mrg      is that sometimes it makes clearer reading to leave out the spaces
    275  1.1  mrg      around exponentiation.
    276  1.1  mrg 
    277  1.1  mrg           E := A * B**2 + 3 * (C - D);
    278  1.1  mrg 
    279  1.1  mrg    * Use parentheses where they clarify the intended association of
    280  1.1  mrg      operands with operators:
    281  1.1  mrg 
    282  1.1  mrg           (A / B) * C
    283  1.1  mrg 
    284  1.1  mrg 
    285  1.1  mrg File: gnat-style.info,  Node: Statements,  Next: Subprograms,  Prev: Expressions and Names,  Up: Top
    286  1.1  mrg 
    287  1.1  mrg 5 Statements
    288  1.1  mrg ************
    289  1.1  mrg 
    290  1.1  mrg * Menu:
    291  1.1  mrg 
    292  1.1  mrg * Simple and Compound Statements::
    293  1.1  mrg * If Statements::
    294  1.1  mrg * Case Statements::
    295  1.1  mrg * Loop Statements::
    296  1.1  mrg * Block Statements::
    297  1.1  mrg 
    298  1.1  mrg 
    299  1.1  mrg File: gnat-style.info,  Node: Simple and Compound Statements,  Next: If Statements,  Up: Statements
    300  1.1  mrg 
    301  1.1  mrg 5.1 Simple and Compound Statements
    302  1.1  mrg ==================================
    303  1.1  mrg 
    304  1.1  mrg    * Use only one statement or label per line.
    305  1.1  mrg 
    306  1.1  mrg    * A longer sequence_of_statements may be divided in logical groups or
    307  1.1  mrg      separated from surrounding code using a blank line.
    308  1.1  mrg 
    309  1.1  mrg 
    310  1.1  mrg File: gnat-style.info,  Node: If Statements,  Next: Case Statements,  Prev: Simple and Compound Statements,  Up: Statements
    311  1.1  mrg 
    312  1.1  mrg 5.2 If Statements
    313  1.1  mrg =================
    314  1.1  mrg 
    315  1.1  mrg    * When the if, elsif or else keywords fit on the same line with
    316  1.1  mrg      the condition and the then keyword, then the statement is
    317  1.1  mrg      formatted as follows:
    318  1.1  mrg 
    319  1.1  mrg           if condition then
    320  1.1  mrg              ...
    321  1.1  mrg           elsif condition then
    322  1.1  mrg              ...
    323  1.1  mrg           else
    324  1.1  mrg              ...
    325  1.1  mrg           end if;
    326  1.1  mrg 
    327  1.1  mrg      When the above layout is not possible, then should be aligned
    328  1.1  mrg      with if, and conditions should preferably be split before an
    329  1.1  mrg      and or or keyword a follows:
    330  1.1  mrg 
    331  1.1  mrg           if long_condition_that_has_to_be_split
    332  1.1  mrg             and then continued_on_the_next_line
    333  1.1  mrg           then
    334  1.1  mrg              ...
    335  1.1  mrg           end if;
    336  1.1  mrg 
    337  1.1  mrg      The elsif, else and end if always line up with the if
    338  1.1  mrg      keyword.  The preferred location for splitting the line is before
    339  1.1  mrg      and or or.  The continuation of a condition is indented with
    340  1.1  mrg      two spaces or as many as needed to make nesting clear.  As an
    341  1.1  mrg      exception, if conditions are closely related either of the
    342  1.1  mrg      following is allowed:
    343  1.1  mrg 
    344  1.1  mrg           if x = lakdsjfhlkashfdlkflkdsalkhfsalkdhflkjdsahf
    345  1.1  mrg                or else
    346  1.1  mrg              x = asldkjhalkdsjfhhfd
    347  1.1  mrg                or else
    348  1.1  mrg              x = asdfadsfadsf
    349  1.1  mrg           then
    350  1.1  mrg             ...
    351  1.1  mrg           end if;
    352  1.1  mrg 
    353  1.1  mrg           if x = lakdsjfhlkashfdlkflkdsalkhfsalkdhflkjdsahf or else
    354  1.1  mrg              x = asldkjhalkdsjfhhfd                         or else
    355  1.1  mrg              x = asdfadsfadsf
    356  1.1  mrg           then
    357  1.1  mrg             ...
    358  1.1  mrg           end if;
    359  1.1  mrg 
    360  1.1  mrg    * Conditions should use short-circuit forms ( and then, or else
    361  1.1  mrg      ), except when the operands are boolean variables or boolean
    362  1.1  mrg      constants.
    363  1.1  mrg 
    364  1.1  mrg    * Complex conditions in if statements are indented two characters:
    365  1.1  mrg 
    366  1.1  mrg           if this_complex_condition
    367  1.1  mrg             and then that_other_one
    368  1.1  mrg             and then one_last_one
    369  1.1  mrg           then
    370  1.1  mrg              ...
    371  1.1  mrg           end if;
    372  1.1  mrg 
    373  1.1  mrg      There are some cases where complex conditionals can be laid out in
    374  1.1  mrg      manners that do not follow these rules to preserve better
    375  1.1  mrg      parallelism between branches, e.g.
    376  1.1  mrg 
    377  1.1  mrg           if xyz.abc (gef) = 'c'
    378  1.1  mrg                or else
    379  1.1  mrg              xyz.abc (gef) = 'x'
    380  1.1  mrg           then
    381  1.1  mrg              ...
    382  1.1  mrg           end if;
    383  1.1  mrg 
    384  1.1  mrg    * Every if block is preceded and followed by a blank line, except
    385  1.1  mrg      where it begins or ends a sequence_of_statements.
    386  1.1  mrg 
    387  1.1  mrg           A := 5;
    388  1.1  mrg 
    389  1.1  mrg           if A = 5 then
    390  1.1  mrg              null;
    391  1.1  mrg           end if;
    392  1.1  mrg 
    393  1.1  mrg           A := 6;
    394  1.1  mrg 
    395  1.1  mrg 
    396  1.1  mrg File: gnat-style.info,  Node: Case Statements,  Next: Loop Statements,  Prev: If Statements,  Up: Statements
    397  1.1  mrg 
    398  1.1  mrg 5.3 Case Statements
    399  1.1  mrg ===================
    400  1.1  mrg 
    401  1.1  mrg    * Layout is as below.  For long case statements, the extra
    402  1.1  mrg      indentation can be saved by aligning the when clauses with the
    403  1.1  mrg      opening case.
    404  1.1  mrg 
    405  1.1  mrg           case expression is
    406  1.1  mrg              when condition =>
    407  1.1  mrg                 ...
    408  1.1  mrg              when condition =>
    409  1.1  mrg                 ...
    410  1.1  mrg           end case;
    411  1.1  mrg 
    412  1.1  mrg 
    413  1.1  mrg File: gnat-style.info,  Node: Loop Statements,  Next: Block Statements,  Prev: Case Statements,  Up: Statements
    414  1.1  mrg 
    415  1.1  mrg 5.4 Loop Statements
    416  1.1  mrg ===================
    417  1.1  mrg 
    418  1.1  mrg    * When possible, have for or while on one line with the condition
    419  1.1  mrg      and the loop keyword.
    420  1.1  mrg 
    421  1.1  mrg           for J in S'Range loop
    422  1.1  mrg              ...
    423  1.1  mrg           end loop;
    424  1.1  mrg 
    425  1.1  mrg      If the condition is too long, split the condition (see If
    426  1.1  mrg      statements above) and align loop with the for or while
    427  1.1  mrg      keyword.
    428  1.1  mrg 
    429  1.1  mrg           while long_condition_that_has_to_be_split
    430  1.1  mrg             and then continued_on_the_next_line
    431  1.1  mrg           loop
    432  1.1  mrg              ...
    433  1.1  mrg           end loop;
    434  1.1  mrg 
    435  1.1  mrg      If the loop_statement has an identifier, it is laid out as follows:
    436  1.1  mrg 
    437  1.1  mrg           Outer : while not condition loop
    438  1.1  mrg              ...
    439  1.1  mrg           end Outer;
    440  1.1  mrg 
    441  1.1  mrg 
    442  1.1  mrg File: gnat-style.info,  Node: Block Statements,  Prev: Loop Statements,  Up: Statements
    443  1.1  mrg 
    444  1.1  mrg 5.5 Block Statements
    445  1.1  mrg ====================
    446  1.1  mrg 
    447  1.1  mrg    * The declare (optional), begin and end words are aligned,
    448  1.1  mrg      except when the block_statement is named.  There is a blank line
    449  1.1  mrg      before the begin keyword:
    450  1.1  mrg 
    451  1.1  mrg           Some_Block : declare
    452  1.1  mrg              ...
    453  1.1  mrg 
    454  1.1  mrg           begin
    455  1.1  mrg              ...
    456  1.1  mrg           end Some_Block;
    457  1.1  mrg 
    458  1.1  mrg 
    459  1.1  mrg File: gnat-style.info,  Node: Subprograms,  Next: Packages and Visibility Rules,  Prev: Statements,  Up: Top
    460  1.1  mrg 
    461  1.1  mrg 6 Subprograms
    462  1.1  mrg *************
    463  1.1  mrg 
    464  1.1  mrg * Menu:
    465  1.1  mrg 
    466  1.1  mrg * Subprogram Declarations::
    467  1.1  mrg * Subprogram Bodies::
    468  1.1  mrg 
    469  1.1  mrg 
    470  1.1  mrg File: gnat-style.info,  Node: Subprogram Declarations,  Next: Subprogram Bodies,  Up: Subprograms
    471  1.1  mrg 
    472  1.1  mrg 6.1 Subprogram Declarations
    473  1.1  mrg ===========================
    474  1.1  mrg 
    475  1.1  mrg    * Do not write the in for parameters.
    476  1.1  mrg 
    477  1.1  mrg           function Length (S : String) return Integer;
    478  1.1  mrg 
    479  1.1  mrg    * When the declaration line for a procedure or a function is too long
    480  1.1  mrg      to fit the entire declaration (including the keyword procedure or
    481  1.1  mrg      function) on a single line, then fold it, putting a single
    482  1.1  mrg      parameter on a line, aligning the colons, as in:
    483  1.1  mrg 
    484  1.1  mrg           procedure Set_Heading
    485  1.1  mrg             (Source : String;
    486  1.1  mrg              Count  : Natural;
    487  1.1  mrg              Pad    : Character := Space;
    488  1.1  mrg              Fill   : Boolean   := True);
    489  1.1  mrg 
    490  1.1  mrg      In the case of a function, if the entire spec does not fit on one
    491  1.1  mrg      line, then the return may appear after the last parameter, as in:
    492  1.1  mrg 
    493  1.1  mrg           function Head
    494  1.1  mrg             (Source : String;
    495  1.1  mrg              Count  : Natural;
    496  1.1  mrg              Pad    : Character := Space) return String;
    497  1.1  mrg 
    498  1.1  mrg      Or it may appear on its own as a separate line.  This form is
    499  1.1  mrg      preferred when putting the return on the same line as the last
    500  1.1  mrg      parameter would result in an overlong line.  The return type may
    501  1.1  mrg      optionally be aligned with the types of the parameters (usually we
    502  1.1  mrg      do this aligning if it results only in a small number of extra
    503  1.1  mrg      spaces, and otherwise we dont attempt to align).  So two
    504  1.1  mrg      alternative forms for the above spec are:
    505  1.1  mrg 
    506  1.1  mrg           function Head
    507  1.1  mrg             (Source : String;
    508  1.1  mrg              Count  : Natural;
    509  1.1  mrg              Pad    : Character := Space)
    510  1.1  mrg              return   String;
    511  1.1  mrg 
    512  1.1  mrg           function Head
    513  1.1  mrg             (Source : String;
    514  1.1  mrg              Count  : Natural;
    515  1.1  mrg              Pad    : Character := Space)
    516  1.1  mrg              return String;
    517  1.1  mrg 
    518  1.1  mrg 
    519  1.1  mrg File: gnat-style.info,  Node: Subprogram Bodies,  Prev: Subprogram Declarations,  Up: Subprograms
    520  1.1  mrg 
    521  1.1  mrg 6.2 Subprogram Bodies
    522  1.1  mrg =====================
    523  1.1  mrg 
    524  1.1  mrg    * Function and procedure bodies should usually be sorted
    525  1.1  mrg      alphabetically.  Do not attempt to sort them in some logical order
    526  1.1  mrg      by functionality.  For a sequence of subprogram specs, a general
    527  1.1  mrg      alphabetical sorting is also usually appropriate, but occasionally
    528  1.1  mrg      it makes sense to group by major function, with appropriate
    529  1.1  mrg      headers.
    530  1.1  mrg 
    531  1.1  mrg    * All subprograms have a header giving the function name, with the
    532  1.1  mrg      following format:
    533  1.1  mrg 
    534  1.1  mrg           -----------------
    535  1.1  mrg           -- My_Function --
    536  1.1  mrg           -----------------
    537  1.1  mrg 
    538  1.1  mrg           procedure My_Function is
    539  1.1  mrg           begin
    540  1.1  mrg             ...
    541  1.1  mrg           end My_Function;
    542  1.1  mrg 
    543  1.1  mrg      Note that the name in the header is preceded by a single space, not
    544  1.1  mrg      two spaces as for other comments.  These headers are used on nested
    545  1.1  mrg      subprograms as well as outer level subprograms.  They may also be
    546  1.1  mrg      used as headers for sections of comments, or collections of
    547  1.1  mrg      declarations that are related.
    548  1.1  mrg 
    549  1.1  mrg    * Every subprogram body must have a preceding subprogram_declaration,
    550  1.1  mrg      which includes proper client documentation so that you do not need
    551  1.1  mrg      to read the subprogram body in order to understand what the
    552  1.1  mrg      subprogram does and how to call it.  All subprograms should be
    553  1.1  mrg      documented, without exceptions.
    554  1.1  mrg 
    555  1.1  mrg    * A sequence of declarations may optionally be separated from the
    556  1.1  mrg      following begin by a blank line.  Just as we optionally allow blank
    557  1.1  mrg      lines in general between declarations, this blank line should be
    558  1.1  mrg      present only if it improves readability.  Generally we avoid this
    559  1.1  mrg      blank line if the declarative part is small (one or two lines) and
    560  1.1  mrg      the body has no blank lines, and we include it if the declarative
    561  1.1  mrg      part is long or if the body has blank lines.
    562  1.1  mrg 
    563  1.1  mrg    * If the declarations in a subprogram contain at least one nested
    564  1.1  mrg      subprogram body, then just before the begin of the enclosing
    565  1.1  mrg      subprogram, there is a comment line and a blank line:
    566  1.1  mrg 
    567  1.1  mrg           --  Start of processing for Enclosing_Subprogram
    568  1.1  mrg 
    569  1.1  mrg           begin
    570  1.1  mrg             ...
    571  1.1  mrg           end Enclosing_Subprogram;
    572  1.1  mrg 
    573  1.1  mrg    * When nested subprograms are present, variables that are referenced
    574  1.1  mrg      by any nested subprogram should precede the nested subprogram
    575  1.1  mrg      specs.  For variables that are not referenced by nested procedures,
    576  1.1  mrg      the declarations can either also be before any of the nested
    577  1.1  mrg      subprogram specs (this is the old style, more generally used).  Or
    578  1.1  mrg      then can come just before the begin, with a header.  The following
    579  1.1  mrg      example shows the two possible styles:
    580  1.1  mrg 
    581  1.1  mrg           procedure Style1 is
    582  1.1  mrg              Var_Referenced_In_Nested      : Integer;
    583  1.1  mrg              Var_Referenced_Only_In_Style1 : Integer;
    584  1.1  mrg 
    585  1.1  mrg              proc Nested;
    586  1.1  mrg              --  Comments ...
    587  1.1  mrg 
    588  1.1  mrg              ------------
    589  1.1  mrg              -- Nested --
    590  1.1  mrg              ------------
    591  1.1  mrg 
    592  1.1  mrg              procedure Nested is
    593  1.1  mrg              begin
    594  1.1  mrg                 ...
    595  1.1  mrg              end Nested;
    596  1.1  mrg 
    597  1.1  mrg           --  Start of processing for Style1
    598  1.1  mrg 
    599  1.1  mrg           begin
    600  1.1  mrg              ...
    601  1.1  mrg           end Style1;
    602  1.1  mrg 
    603  1.1  mrg           procedure Style2 is
    604  1.1  mrg              Var_Referenced_In_Nested : Integer;
    605  1.1  mrg 
    606  1.1  mrg              proc Nested;
    607  1.1  mrg              --  Comments ...
    608  1.1  mrg 
    609  1.1  mrg              ------------
    610  1.1  mrg              -- Nested --
    611  1.1  mrg              ------------
    612  1.1  mrg 
    613  1.1  mrg              procedure Nested is
    614  1.1  mrg              begin
    615  1.1  mrg                 ...
    616  1.1  mrg              end Nested;
    617  1.1  mrg 
    618  1.1  mrg              --  Local variables
    619  1.1  mrg 
    620  1.1  mrg              Var_Referenced_Only_In_Style2 : Integer;
    621  1.1  mrg 
    622  1.1  mrg           --  Start of processing for Style2
    623  1.1  mrg 
    624  1.1  mrg           begin
    625  1.1  mrg              ...
    626  1.1  mrg           end Style2;
    627  1.1  mrg 
    628  1.1  mrg      For new code, we generally prefer Style2, but we do not insist on
    629  1.1  mrg      modifying all legacy occurrences of Style1, which is still much
    630  1.1  mrg      more common in the sources.
    631  1.1  mrg 
    632  1.1  mrg 
    633  1.1  mrg File: gnat-style.info,  Node: Packages and Visibility Rules,  Next: Program Structure and Compilation Issues,  Prev: Subprograms,  Up: Top
    634  1.1  mrg 
    635  1.1  mrg 7 Packages and Visibility Rules
    636  1.1  mrg *******************************
    637  1.1  mrg 
    638  1.1  mrg    * All program units and subprograms have their name at the end:
    639  1.1  mrg 
    640  1.1  mrg           package P is
    641  1.1  mrg              ...
    642  1.1  mrg           end P;
    643  1.1  mrg 
    644  1.1  mrg    * We will use the style of use -ing with -ed packages, with the
    645  1.1  mrg      context clauses looking like:
    646  1.1  mrg 
    647  1.1  mrg           with A; use A;
    648  1.1  mrg           with B; use B;
    649  1.1  mrg 
    650  1.1  mrg    * Names declared in the visible part of packages should be unique, to
    651  1.1  mrg      prevent name clashes when the packages are use d.
    652  1.1  mrg 
    653  1.1  mrg           package Entity is
    654  1.1  mrg              type Entity_Kind is ...;
    655  1.1  mrg              ...
    656  1.1  mrg           end Entity;
    657  1.1  mrg 
    658  1.1  mrg    * After the file header comment, the context clause and unit
    659  1.1  mrg      specification should be the first thing in a program_unit.
    660  1.1  mrg 
    661  1.1  mrg    * Preelaborate, Pure and Elaborate_Body pragmas should be added right
    662  1.1  mrg      after the package name, indented an extra level and using the
    663  1.1  mrg      parameterless form:
    664  1.1  mrg 
    665  1.1  mrg           package Preelaborate_Package is
    666  1.1  mrg              pragma Preelaborate;
    667  1.1  mrg              ...
    668  1.1  mrg           end Preelaborate_Package;
    669  1.1  mrg 
    670  1.1  mrg 
    671  1.1  mrg File: gnat-style.info,  Node: Program Structure and Compilation Issues,  Next: Index,  Prev: Packages and Visibility Rules,  Up: Top
    672  1.1  mrg 
    673  1.1  mrg 8 Program Structure and Compilation Issues
    674  1.1  mrg ******************************************
    675  1.1  mrg 
    676  1.1  mrg    * Every GNAT source file must be compiled with the -gnatg switch to
    677  1.1  mrg      check the coding style.  (Note that you should look at style.adb to
    678  1.1  mrg      see the lexical rules enforced by -gnatg ).
    679  1.1  mrg 
    680  1.1  mrg    * Each source file should contain only one compilation unit.
    681  1.1  mrg 
    682  1.1  mrg    * Filenames should be 8 or fewer characters, followed by the .adb
    683  1.1  mrg      extension for a body or .ads for a spec.
    684  1.1  mrg 
    685  1.1  mrg    * Unit names should be distinct when krunched to 8 characters (see
    686  1.1  mrg      krunch.ads) and the filenames should match the unit name, except
    687  1.1  mrg      that they are all lower case.
    688  1.1  mrg 
    689  1.1  mrg * Menu:
    690  1.1  mrg 
    691  1.1  mrg * GNU Free Documentation License::
    692  1.1  mrg 
    693  1.1  mrg 
    694  1.1  mrg File: gnat-style.info,  Node: GNU Free Documentation License,  Up: Program Structure and Compilation Issues
    695  1.1  mrg 
    696  1.1  mrg 8.1 GNU Free Documentation License
    697  1.1  mrg ==================================
    698  1.1  mrg 
    699  1.1  mrg Version 1.3, 3 November 2008
    700  1.1  mrg 
    701  1.1  mrg Copyright 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc
    702  1.1  mrg https://fsf.org/
    703  1.1  mrg 
    704  1.1  mrg Everyone is permitted to copy and distribute verbatim copies of this
    705  1.1  mrg license document, but changing it is not allowed.
    706  1.1  mrg 
    707  1.1  mrg `Preamble'
    708  1.1  mrg 
    709  1.1  mrg The purpose of this License is to make a manual, textbook, or other
    710  1.1  mrg functional and useful document free in the sense of freedom: to assure
    711  1.1  mrg everyone the effective freedom to copy and redistribute it, with or
    712  1.1  mrg without modifying it, either commercially or noncommercially.
    713  1.1  mrg Secondarily, this License preserves for the author and publisher a way
    714  1.1  mrg to get credit for their work, while not being considered responsible for
    715  1.1  mrg modifications made by others.
    716  1.1  mrg 
    717  1.1  mrg This License is a kind of copyleft, which means that derivative works
    718  1.1  mrg of the document must themselves be free in the same sense.  It
    719  1.1  mrg complements the GNU General Public License, which is a copyleft license
    720  1.1  mrg designed for free software.
    721  1.1  mrg 
    722  1.1  mrg We have designed this License in order to use it for manuals for free
    723  1.1  mrg software, because free software needs free documentation: a free program
    724  1.1  mrg should come with manuals providing the same freedoms that the software
    725  1.1  mrg does.  But this License is not limited to software manuals; it can be
    726  1.1  mrg used for any textual work, regardless of subject matter or whether it is
    727  1.1  mrg published as a printed book.  We recommend this License principally for
    728  1.1  mrg works whose purpose is instruction or reference.
    729  1.1  mrg 
    730  1.1  mrg `1.  APPLICABILITY AND DEFINITIONS'
    731  1.1  mrg 
    732  1.1  mrg This License applies to any manual or other work, in any medium, that
    733  1.1  mrg contains a notice placed by the copyright holder saying it can be
    734  1.1  mrg distributed under the terms of this License.  Such a notice grants a
    735  1.1  mrg world-wide, royalty-free license, unlimited in duration, to use that
    736  1.1  mrg work under the conditions stated herein.  The `Document', below, refers
    737  1.1  mrg to any such manual or work.  Any member of the public is a licensee, and
    738  1.1  mrg is addressed as `you'.  You accept the license if you copy, modify or
    739  1.1  mrg distribute the work in a way requiring permission under copyright law.
    740  1.1  mrg 
    741  1.1  mrg A `Modified Version' of the Document means any work containing the
    742  1.1  mrg Document or a portion of it, either copied verbatim, or with
    743  1.1  mrg modifications and/or translated into another language.
    744  1.1  mrg 
    745  1.1  mrg A `Secondary Section' is a named appendix or a front-matter section of
    746  1.1  mrg the Document that deals exclusively with the relationship of the
    747  1.1  mrg publishers or authors of the Document to the Documents overall subject
    748  1.1  mrg (or to related matters) and contains nothing that could fall directly
    749  1.1  mrg within that overall subject.  (Thus, if the Document is in part a
    750  1.1  mrg textbook of mathematics, a Secondary Section may not explain any
    751  1.1  mrg mathematics.)  The relationship could be a matter of historical
    752  1.1  mrg connection with the subject or with related matters, or of legal,
    753  1.1  mrg commercial, philosophical, ethical or political position regarding them.
    754  1.1  mrg 
    755  1.1  mrg The `Invariant Sections' are certain Secondary Sections whose titles
    756  1.1  mrg are designated, as being those of Invariant Sections, in the notice that
    757  1.1  mrg says that the Document is released under this License.  If a section
    758  1.1  mrg does not fit the above definition of Secondary then it is not allowed to
    759  1.1  mrg be designated as Invariant.  The Document may contain zero Invariant
    760  1.1  mrg Sections.  If the Document does not identify any Invariant Sections then
    761  1.1  mrg there are none.
    762  1.1  mrg 
    763  1.1  mrg The `Cover Texts' are certain short passages of text that are listed,
    764  1.1  mrg as Front-Cover Texts or Back-Cover Texts, in the notice that says that
    765  1.1  mrg the Document is released under this License.  A Front-Cover Text may be
    766  1.1  mrg at most 5 words, and a Back-Cover Text may be at most 25 words.
    767  1.1  mrg 
    768  1.1  mrg A `Transparent' copy of the Document means a machine-readable copy,
    769  1.1  mrg represented in a format whose specification is available to the general
    770  1.1  mrg public, that is suitable for revising the document straightforwardly
    771  1.1  mrg with generic text editors or (for images composed of pixels) generic
    772  1.1  mrg paint programs or (for drawings) some widely available drawing editor,
    773  1.1  mrg and that is suitable for input to text formatters or for automatic
    774  1.1  mrg translation to a variety of formats suitable for input to text
    775  1.1  mrg formatters.  A copy made in an otherwise Transparent file format whose
    776  1.1  mrg markup, or absence of markup, has been arranged to thwart or discourage
    777  1.1  mrg subsequent modification by readers is not Transparent.  An image format
    778  1.1  mrg is not Transparent if used for any substantial amount of text.  A copy
    779  1.1  mrg that is not Transparent is called `Opaque'.
    780  1.1  mrg 
    781  1.1  mrg Examples of suitable formats for Transparent copies include plain ASCII
    782  1.1  mrg without markup, Texinfo input format, LaTeX input format, SGML or XML
    783  1.1  mrg using a publicly available DTD, and standard-conforming simple HTML,
    784  1.1  mrg PostScript or PDF designed for human modification.  Examples of
    785  1.1  mrg transparent image formats include PNG, XCF and JPG. Opaque formats
    786  1.1  mrg include proprietary formats that can be read and edited only by
    787  1.1  mrg proprietary word processors, SGML or XML for which the DTD and/or
    788  1.1  mrg processing tools are not generally available, and the machine-generated
    789  1.1  mrg HTML, PostScript or PDF produced by some word processors for output
    790  1.1  mrg purposes only.
    791  1.1  mrg 
    792  1.1  mrg The `Title Page' means, for a printed book, the title page itself,
    793  1.1  mrg plus such following pages as are needed to hold, legibly, the material
    794  1.1  mrg this License requires to appear in the title page.  For works in formats
    795  1.1  mrg which do not have any title page as such, Title Page means the text
    796  1.1  mrg near the most prominent appearance of the works title, preceding the
    797  1.1  mrg beginning of the body of the text.
    798  1.1  mrg 
    799  1.1  mrg The `publisher' means any person or entity that distributes copies of
    800  1.1  mrg the Document to the public.
    801  1.1  mrg 
    802  1.1  mrg A section `Entitled XYZ' means a named subunit of the Document whose
    803  1.1  mrg title either is precisely XYZ or contains XYZ in parentheses following
    804  1.1  mrg text that translates XYZ in another language.  (Here XYZ stands for a
    805  1.1  mrg specific section name mentioned below, such as `Acknowledgements',
    806  1.1  mrg `Dedications', `Endorsements', or `History'.)  To `Preserve the
    807  1.1  mrg Title' of such a section when you modify the Document means that it
    808  1.1  mrg remains a section Entitled XYZ according to this definition.
    809  1.1  mrg 
    810  1.1  mrg The Document may include Warranty Disclaimers next to the notice which
    811  1.1  mrg states that this License applies to the Document.  These Warranty
    812  1.1  mrg Disclaimers are considered to be included by reference in this License,
    813  1.1  mrg but only as regards disclaiming warranties: any other implication that
    814  1.1  mrg these Warranty Disclaimers may have is void and has no effect on the
    815  1.1  mrg meaning of this License.
    816  1.1  mrg 
    817  1.1  mrg `2.  VERBATIM COPYING'
    818  1.1  mrg 
    819  1.1  mrg You may copy and distribute the Document in any medium, either
    820  1.1  mrg commercially or noncommercially, provided that this License, the
    821  1.1  mrg copyright notices, and the license notice saying this License applies to
    822  1.1  mrg the Document are reproduced in all copies, and that you add no other
    823  1.1  mrg conditions whatsoever to those of this License.  You may not use
    824  1.1  mrg technical measures to obstruct or control the reading or further copying
    825  1.1  mrg of the copies you make or distribute.  However, you may accept
    826  1.1  mrg compensation in exchange for copies.  If you distribute a large enough
    827  1.1  mrg number of copies you must also follow the conditions in section 3.
    828  1.1  mrg 
    829  1.1  mrg You may also lend copies, under the same conditions stated above, and
    830  1.1  mrg you may publicly display copies.
    831  1.1  mrg 
    832  1.1  mrg `3.  COPYING IN QUANTITY'
    833  1.1  mrg 
    834  1.1  mrg If you publish printed copies (or copies in media that commonly have
    835  1.1  mrg printed covers) of the Document, numbering more than 100, and the
    836  1.1  mrg Documents license notice requires Cover Texts, you must enclose the
    837  1.1  mrg copies in covers that carry, clearly and legibly, all these Cover Texts:
    838  1.1  mrg Front-Cover Texts on the front cover, and Back-Cover Texts on the back
    839  1.1  mrg cover.  Both covers must also clearly and legibly identify you as the
    840  1.1  mrg publisher of these copies.  The front cover must present the full title
    841  1.1  mrg with all words of the title equally prominent and visible.  You may add
    842  1.1  mrg other material on the covers in addition.  Copying with changes limited
    843  1.1  mrg to the covers, as long as they preserve the title of the Document and
    844  1.1  mrg satisfy these conditions, can be treated as verbatim copying in other
    845  1.1  mrg respects.
    846  1.1  mrg 
    847  1.1  mrg If the required texts for either cover are too voluminous to fit
    848  1.1  mrg legibly, you should put the first ones listed (as many as fit
    849  1.1  mrg reasonably) on the actual cover, and continue the rest onto adjacent
    850  1.1  mrg pages.
    851  1.1  mrg 
    852  1.1  mrg If you publish or distribute Opaque copies of the Document numbering
    853  1.1  mrg more than 100, you must either include a machine-readable Transparent
    854  1.1  mrg copy along with each Opaque copy, or state in or with each Opaque copy a
    855  1.1  mrg computer-network location from which the general network-using public
    856  1.1  mrg has access to download using public-standard network protocols a
    857  1.1  mrg complete Transparent copy of the Document, free of added material.  If
    858  1.1  mrg you use the latter option, you must take reasonably prudent steps, when
    859  1.1  mrg you begin distribution of Opaque copies in quantity, to ensure that this
    860  1.1  mrg Transparent copy will remain thus accessible at the stated location
    861  1.1  mrg until at least one year after the last time you distribute an Opaque
    862  1.1  mrg copy (directly or through your agents or retailers) of that edition to
    863  1.1  mrg the public.
    864  1.1  mrg 
    865  1.1  mrg It is requested, but not required, that you contact the authors of the
    866  1.1  mrg Document well before redistributing any large number of copies, to give
    867  1.1  mrg them a chance to provide you with an updated version of the Document.
    868  1.1  mrg 
    869  1.1  mrg `4.  MODIFICATIONS'
    870  1.1  mrg 
    871  1.1  mrg You may copy and distribute a Modified Version of the Document under the
    872  1.1  mrg conditions of sections 2 and 3 above, provided that you release the
    873  1.1  mrg Modified Version under precisely this License, with the Modified Version
    874  1.1  mrg filling the role of the Document, thus licensing distribution and
    875  1.1  mrg modification of the Modified Version to whoever possesses a copy of it.
    876  1.1  mrg In addition, you must do these things in the Modified Version:
    877  1.1  mrg 
    878  1.1  mrg   A. Use in the Title Page (and on the covers, if any) a title distinct
    879  1.1  mrg      from that of the Document, and from those of previous versions
    880  1.1  mrg      (which should, if there were any, be listed in the History section
    881  1.1  mrg      of the Document).  You may use the same title as a previous version
    882  1.1  mrg      if the original publisher of that version gives permission.
    883  1.1  mrg 
    884  1.1  mrg   B. List on the Title Page, as authors, one or more persons or entities
    885  1.1  mrg      responsible for authorship of the modifications in the Modified
    886  1.1  mrg      Version, together with at least five of the principal authors of
    887  1.1  mrg      the Document (all of its principal authors, if it has fewer than
    888  1.1  mrg      five), unless they release you from this requirement.
    889  1.1  mrg 
    890  1.1  mrg   C. State on the Title page the name of the publisher of the Modified
    891  1.1  mrg      Version, as the publisher.
    892  1.1  mrg 
    893  1.1  mrg   D. Preserve all the copyright notices of the Document.
    894  1.1  mrg 
    895  1.1  mrg   E. Add an appropriate copyright notice for your modifications adjacent
    896  1.1  mrg      to the other copyright notices.
    897  1.1  mrg 
    898  1.1  mrg   F. Include, immediately after the copyright notices, a license notice
    899  1.1  mrg      giving the public permission to use the Modified Version under the
    900  1.1  mrg      terms of this License, in the form shown in the Addendum below.
    901  1.1  mrg 
    902  1.1  mrg   G. Preserve in that license notice the full lists of Invariant
    903  1.1  mrg      Sections and required Cover Texts given in the Documents license
    904  1.1  mrg      notice.
    905  1.1  mrg 
    906  1.1  mrg   H. Include an unaltered copy of this License.
    907  1.1  mrg 
    908  1.1  mrg   I. Preserve the section Entitled History, Preserve its Title, and
    909  1.1  mrg      add to it an item stating at least the title, year, new authors,
    910  1.1  mrg      and publisher of the Modified Version as given on the Title Page.
    911  1.1  mrg      If there is no section Entitled History in the Document, create
    912  1.1  mrg      one stating the title, year, authors, and publisher of the Document
    913  1.1  mrg      as given on its Title Page, then add an item describing the
    914  1.1  mrg      Modified Version as stated in the previous sentence.
    915  1.1  mrg 
    916  1.1  mrg   J. Preserve the network location, if any, given in the Document for
    917  1.1  mrg      public access to a Transparent copy of the Document, and likewise
    918  1.1  mrg      the network locations given in the Document for previous versions
    919  1.1  mrg      it was based on.  These may be placed in the History section.
    920  1.1  mrg      You may omit a network location for a work that was published at
    921  1.1  mrg      least four years before the Document itself, or if the original
    922  1.1  mrg      publisher of the version it refers to gives permission.
    923  1.1  mrg 
    924  1.1  mrg   K. For any section Entitled Acknowledgements or Dedications,
    925  1.1  mrg      Preserve the Title of the section, and preserve in the section all
    926  1.1  mrg      the substance and tone of each of the contributor acknowledgements
    927  1.1  mrg      and/or dedications given therein.
    928  1.1  mrg 
    929  1.1  mrg   L. Preserve all the Invariant Sections of the Document, unaltered in
    930  1.1  mrg      their text and in their titles.  Section numbers or the equivalent
    931  1.1  mrg      are not considered part of the section titles.
    932  1.1  mrg 
    933  1.1  mrg   M. Delete any section Entitled Endorsements.  Such a section may not
    934  1.1  mrg      be included in the Modified Version.
    935  1.1  mrg 
    936  1.1  mrg   N. Do not retitle any existing section to be Entitled Endorsements
    937  1.1  mrg      or to conflict in title with any Invariant Section.
    938  1.1  mrg 
    939  1.1  mrg   O. Preserve any Warranty Disclaimers.
    940  1.1  mrg 
    941  1.1  mrg If the Modified Version includes new front-matter sections or appendices
    942  1.1  mrg that qualify as Secondary Sections and contain no material copied from
    943  1.1  mrg the Document, you may at your option designate some or all of these
    944  1.1  mrg sections as invariant.  To do this, add their titles to the list of
    945  1.1  mrg Invariant Sections in the Modified Versions license notice.  These
    946  1.1  mrg titles must be distinct from any other section titles.
    947  1.1  mrg 
    948  1.1  mrg You may add a section Entitled Endorsements, provided it contains
    949  1.1  mrg nothing but endorsements of your Modified Version by various partiesfor
    950  1.1  mrg example, statements of peer review or that the text has been approved by
    951  1.1  mrg an organization as the authoritative definition of a standard.
    952  1.1  mrg 
    953  1.1  mrg You may add a passage of up to five words as a Front-Cover Text, and a
    954  1.1  mrg passage of up to 25 words as a Back-Cover Text, to the end of the list
    955  1.1  mrg of Cover Texts in the Modified Version.  Only one passage of Front-Cover
    956  1.1  mrg Text and one of Back-Cover Text may be added by (or through arrangements
    957  1.1  mrg made by) any one entity.  If the Document already includes a cover text
    958  1.1  mrg for the same cover, previously added by you or by arrangement made by
    959  1.1  mrg the same entity you are acting on behalf of, you may not add another;
    960  1.1  mrg but you may replace the old one, on explicit permission from the
    961  1.1  mrg previous publisher that added the old one.
    962  1.1  mrg 
    963  1.1  mrg The author(s) and publisher(s) of the Document do not by this License
    964  1.1  mrg give permission to use their names for publicity for or to assert or
    965  1.1  mrg imply endorsement of any Modified Version.
    966  1.1  mrg 
    967  1.1  mrg `5.  COMBINING DOCUMENTS'
    968  1.1  mrg 
    969  1.1  mrg You may combine the Document with other documents released under this
    970  1.1  mrg License, under the terms defined in section 4 above for modified
    971  1.1  mrg versions, provided that you include in the combination all of the
    972  1.1  mrg Invariant Sections of all of the original documents, unmodified, and
    973  1.1  mrg list them all as Invariant Sections of your combined work in its license
    974  1.1  mrg notice, and that you preserve all their Warranty Disclaimers.
    975  1.1  mrg 
    976  1.1  mrg The combined work need only contain one copy of this License, and
    977  1.1  mrg multiple identical Invariant Sections may be replaced with a single
    978  1.1  mrg copy.  If there are multiple Invariant Sections with the same name but
    979  1.1  mrg different contents, make the title of each such section unique by adding
    980  1.1  mrg at the end of it, in parentheses, the name of the original author or
    981  1.1  mrg publisher of that section if known, or else a unique number.  Make the
    982  1.1  mrg same adjustment to the section titles in the list of Invariant Sections
    983  1.1  mrg in the license notice of the combined work.
    984  1.1  mrg 
    985  1.1  mrg In the combination, you must combine any sections Entitled History in
    986  1.1  mrg the various original documents, forming one section Entitled History;
    987  1.1  mrg likewise combine any sections Entitled Acknowledgements, and any
    988  1.1  mrg sections Entitled Dedications.  You must delete all sections Entitled
    989  1.1  mrg Endorsements.
    990  1.1  mrg 
    991  1.1  mrg `6.  COLLECTIONS OF DOCUMENTS'
    992  1.1  mrg 
    993  1.1  mrg You may make a collection consisting of the Document and other documents
    994  1.1  mrg released under this License, and replace the individual copies of this
    995  1.1  mrg License in the various documents with a single copy that is included in
    996  1.1  mrg the collection, provided that you follow the rules of this License for
    997  1.1  mrg verbatim copying of each of the documents in all other respects.
    998  1.1  mrg 
    999  1.1  mrg You may extract a single document from such a collection, and distribute
   1000  1.1  mrg it individually under this License, provided you insert a copy of this
   1001  1.1  mrg License into the extracted document, and follow this License in all
   1002  1.1  mrg other respects regarding verbatim copying of that document.
   1003  1.1  mrg 
   1004  1.1  mrg `7.  AGGREGATION WITH INDEPENDENT WORKS'
   1005  1.1  mrg 
   1006  1.1  mrg A compilation of the Document or its derivatives with other separate and
   1007  1.1  mrg independent documents or works, in or on a volume of a storage or
   1008  1.1  mrg distribution medium, is called an aggregate if the copyright resulting
   1009  1.1  mrg from the compilation is not used to limit the legal rights of the
   1010  1.1  mrg compilations users beyond what the individual works permit.  When the
   1011  1.1  mrg Document is included in an aggregate, this License does not apply to the
   1012  1.1  mrg other works in the aggregate which are not themselves derivative works
   1013  1.1  mrg of the Document.
   1014  1.1  mrg 
   1015  1.1  mrg If the Cover Text requirement of section 3 is applicable to these copies
   1016  1.1  mrg of the Document, then if the Document is less than one half of the
   1017  1.1  mrg entire aggregate, the Documents Cover Texts may be placed on covers
   1018  1.1  mrg that bracket the Document within the aggregate, or the electronic
   1019  1.1  mrg equivalent of covers if the Document is in electronic form.  Otherwise
   1020  1.1  mrg they must appear on printed covers that bracket the whole aggregate.
   1021  1.1  mrg 
   1022  1.1  mrg `8.  TRANSLATION'
   1023  1.1  mrg 
   1024  1.1  mrg Translation is considered a kind of modification, so you may distribute
   1025  1.1  mrg translations of the Document under the terms of section 4.  Replacing
   1026  1.1  mrg Invariant Sections with translations requires special permission from
   1027  1.1  mrg their copyright holders, but you may include translations of some or all
   1028  1.1  mrg Invariant Sections in addition to the original versions of these
   1029  1.1  mrg Invariant Sections.  You may include a translation of this License, and
   1030  1.1  mrg all the license notices in the Document, and any Warranty Disclaimers,
   1031  1.1  mrg provided that you also include the original English version of this
   1032  1.1  mrg License and the original versions of those notices and disclaimers.  In
   1033  1.1  mrg case of a disagreement between the translation and the original version
   1034  1.1  mrg of this License or a notice or disclaimer, the original version will
   1035  1.1  mrg prevail.
   1036  1.1  mrg 
   1037  1.1  mrg If a section in the Document is Entitled Acknowledgements,
   1038  1.1  mrg Dedications, or History, the requirement (section 4) to Preserve its
   1039  1.1  mrg Title (section 1) will typically require changing the actual title.
   1040  1.1  mrg 
   1041  1.1  mrg `9.  TERMINATION'
   1042  1.1  mrg 
   1043  1.1  mrg You may not copy, modify, sublicense, or distribute the Document except
   1044  1.1  mrg as expressly provided under this License.  Any attempt otherwise to
   1045  1.1  mrg copy, modify, sublicense, or distribute it is void, and will
   1046  1.1  mrg automatically terminate your rights under this License.
   1047  1.1  mrg 
   1048  1.1  mrg However, if you cease all violation of this License, then your license
   1049  1.1  mrg from a particular copyright holder is reinstated (a) provisionally,
   1050  1.1  mrg unless and until the copyright holder explicitly and finally terminates
   1051  1.1  mrg your license, and (b) permanently, if the copyright holder fails to
   1052  1.1  mrg notify you of the violation by some reasonable means prior to 60 days
   1053  1.1  mrg after the cessation.
   1054  1.1  mrg 
   1055  1.1  mrg Moreover, your license from a particular copyright holder is reinstated
   1056  1.1  mrg permanently if the copyright holder notifies you of the violation by
   1057  1.1  mrg some reasonable means, this is the first time you have received notice
   1058  1.1  mrg of violation of this License (for any work) from that copyright holder,
   1059  1.1  mrg and you cure the violation prior to 30 days after your receipt of the
   1060  1.1  mrg notice.
   1061  1.1  mrg 
   1062  1.1  mrg Termination of your rights under this section does not terminate the
   1063  1.1  mrg licenses of parties who have received copies or rights from you under
   1064  1.1  mrg this License.  If your rights have been terminated and not permanently
   1065  1.1  mrg reinstated, receipt of a copy of some or all of the same material does
   1066  1.1  mrg not give you any rights to use it.
   1067  1.1  mrg 
   1068  1.1  mrg `10.  FUTURE REVISIONS OF THIS LICENSE'
   1069  1.1  mrg 
   1070  1.1  mrg The Free Software Foundation may publish new, revised versions of the
   1071  1.1  mrg GNU Free Documentation License from time to time.  Such new versions
   1072  1.1  mrg will be similar in spirit to the present version, but may differ in
   1073  1.1  mrg detail to address new problems or concerns.  See
   1074  1.1  mrg https://www.gnu.org/copyleft/.
   1075  1.1  mrg 
   1076  1.1  mrg Each version of the License is given a distinguishing version number.
   1077  1.1  mrg If the Document specifies that a particular numbered version of this
   1078  1.1  mrg License or any later version applies to it, you have the option of
   1079  1.1  mrg following the terms and conditions either of that specified version or
   1080  1.1  mrg of any later version that has been published (not as a draft) by the
   1081  1.1  mrg Free Software Foundation.  If the Document does not specify a version
   1082  1.1  mrg number of this License, you may choose any version ever published (not
   1083  1.1  mrg as a draft) by the Free Software Foundation.  If the Document specifies
   1084  1.1  mrg that a proxy can decide which future versions of this License can be
   1085  1.1  mrg used, that proxys public statement of acceptance of a version
   1086  1.1  mrg permanently authorizes you to choose that version for the Document.
   1087  1.1  mrg 
   1088  1.1  mrg `11.  RELICENSING'
   1089  1.1  mrg 
   1090  1.1  mrg Massive Multiauthor Collaboration Site (or MMC Site) means any World
   1091  1.1  mrg Wide Web server that publishes copyrightable works and also provides
   1092  1.1  mrg prominent facilities for anybody to edit those works.  A public wiki
   1093  1.1  mrg that anybody can edit is an example of such a server.  A Massive
   1094  1.1  mrg Multiauthor Collaboration (or MMC) contained in the site means any
   1095  1.1  mrg set of copyrightable works thus published on the MMC site.
   1096  1.1  mrg 
   1097  1.1  mrg CC-BY-SA means the Creative Commons Attribution-Share Alike 3.0
   1098  1.1  mrg license published by Creative Commons Corporation, a not-for-profit
   1099  1.1  mrg corporation with a principal place of business in San Francisco,
   1100  1.1  mrg California, as well as future copyleft versions of that license
   1101  1.1  mrg published by that same organization.
   1102  1.1  mrg 
   1103  1.1  mrg Incorporate means to publish or republish a Document, in whole or in
   1104  1.1  mrg part, as part of another Document.
   1105  1.1  mrg 
   1106  1.1  mrg An MMC is eligible for relicensing if it is licensed under this
   1107  1.1  mrg License, and if all works that were first published under this License
   1108  1.1  mrg somewhere other than this MMC, and subsequently incorporated in whole or
   1109  1.1  mrg in part into the MMC, (1) had no cover texts or invariant sections, and
   1110  1.1  mrg (2) were thus incorporated prior to November 1, 2008.
   1111  1.1  mrg 
   1112  1.1  mrg The operator of an MMC Site may republish an MMC contained in the site
   1113  1.1  mrg under CC-BY-SA on the same site at any time before August 1, 2009,
   1114  1.1  mrg provided the MMC is eligible for relicensing.
   1115  1.1  mrg 
   1116  1.1  mrg `ADDENDUM: How to use this License for your documents'
   1117  1.1  mrg 
   1118  1.1  mrg To use this License in a document you have written, include a copy of
   1119  1.1  mrg the License in the document and put the following copyright and license
   1120  1.1  mrg notices just after the title page:
   1121  1.1  mrg 
   1122  1.1  mrg      Copyright  YEAR YOUR NAME. Permission is granted to copy,
   1123  1.1  mrg      distribute and/or modify this document under the terms of the GNU
   1124  1.1  mrg      Free Documentation License, Version 1.3 or any later version
   1125  1.1  mrg      published by the Free Software Foundation; with no Invariant
   1126  1.1  mrg      Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of
   1127  1.1  mrg      the license is included in the section entitled GNU Free
   1128  1.1  mrg      Documentation License.
   1129  1.1  mrg 
   1130  1.1  mrg If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
   1131  1.1  mrg replace the with  Texts. line with this:
   1132  1.1  mrg 
   1133  1.1  mrg      with the Invariant Sections being LIST THEIR TITLES, with the
   1134  1.1  mrg      Front-Cover Texts being LIST, and with the Back-Cover Texts being
   1135  1.1  mrg      LIST.
   1136  1.1  mrg 
   1137  1.1  mrg If you have Invariant Sections without Cover Texts, or some other
   1138  1.1  mrg combination of the three, merge those two alternatives to suit the
   1139  1.1  mrg situation.
   1140  1.1  mrg 
   1141  1.1  mrg If your document contains nontrivial examples of program code, we
   1142  1.1  mrg recommend releasing these examples in parallel under your choice of free
   1143  1.1  mrg software license, such as the GNU General Public License, to permit
   1144  1.1  mrg their use in free software.
   1145  1.1  mrg 
   1146  1.1  mrg 
   1147  1.1  mrg File: gnat-style.info,  Node: Index,  Prev: Program Structure and Compilation Issues,  Up: Top
   1148  1.1  mrg 
   1149  1.1  mrg Index
   1150  1.1  mrg *****
   1151  1.1  mrg 
   1152  1.1  mrg [index]
   1153  1.1  mrg * Menu:
   1154  1.1  mrg 
   1155  1.1  mrg * -gnatg option (to gcc):                Program Structure and Compilation Issues.
   1156  1.1  mrg                                                                (line 10)
   1157  1.1  mrg * Alignment (in a block statement):      Block Statements.     (line 10)
   1158  1.1  mrg * Alignment (in a loop statement):       Loop Statements.      (line 17)
   1159  1.1  mrg * Alignment (in an if statement):        If Statements.        (line 10)
   1160  1.1  mrg * Alignment (in comments):               Comments.             (line 51)
   1161  1.1  mrg * Alignment (in declarations):           Declarations and Types.
   1162  1.1  mrg                                                                (line  9)
   1163  1.1  mrg * ASCII:                                 Character Set and Separators.
   1164  1.1  mrg                                                                (line  6)
   1165  1.1  mrg * Blank lines (in an if statement):      If Statements.        (line 78)
   1166  1.1  mrg * Blank lines (in comments):             Comments.             (line 25)
   1167  1.1  mrg * Blank lines (in subprogram bodies):    Subprogram Bodies.    (line 37)
   1168  1.1  mrg * Casing (for identifiers):              Identifiers.          (line  9)
   1169  1.1  mrg * Casing (for reserved words):           Reserved Words.       (line  8)
   1170  1.1  mrg * Casing (in comments):                  Comments.             (line 16)
   1171  1.1  mrg * Character set:                         Character Set and Separators.
   1172  1.1  mrg                                                                (line  6)
   1173  1.1  mrg * End-of-line:                           Character Set and Separators.
   1174  1.1  mrg                                                                (line  6)
   1175  1.1  mrg * File name length:                      Program Structure and Compilation Issues.
   1176  1.1  mrg                                                                (line 15)
   1177  1.1  mrg * Hiding of outer entities:              Declarations and Types.
   1178  1.1  mrg                                                                (line 20)
   1179  1.1  mrg * Indentation:                           Character Set and Separators.
   1180  1.1  mrg                                                                (line  6)
   1181  1.1  mrg * Indentation <1>:                       Comments.             (line 25)
   1182  1.1  mrg * Indentation (in if statements):        If Statements.        (line 57)
   1183  1.1  mrg * krunch.ads file:                       Program Structure and Compilation Issues.
   1184  1.1  mrg                                                                (line 19)
   1185  1.1  mrg * Line length:                           Character Set and Separators.
   1186  1.1  mrg                                                                (line  6)
   1187  1.1  mrg * Name clash avoidance:                  Packages and Visibility Rules.
   1188  1.1  mrg                                                                (line 21)
   1189  1.1  mrg * Operators:                             Expressions and Names.
   1190  1.1  mrg                                                                (line 12)
   1191  1.1  mrg * Parenthesization of expressions:       Expressions and Names.
   1192  1.1  mrg                                                                (line 17)
   1193  1.1  mrg * Separators:                            Character Set and Separators.
   1194  1.1  mrg                                                                (line  6)
   1195  1.1  mrg * Short-circuit forms:                   If Statements.        (line 55)
   1196  1.1  mrg * style.adb file:                        Character Set and Separators.
   1197  1.1  mrg                                                                (line 25)
   1198  1.1  mrg * style.adb file <1>:                    Program Structure and Compilation Issues.
   1199  1.1  mrg                                                                (line 10)
   1200  1.1  mrg * Underscores:                           Identifiers.          (line 15)
   1201  1.1  mrg * Underscores <1>:                       Numeric Literals.     (line  9)
   1202  1.1  mrg * use clauses:                           Packages and Visibility Rules.
   1203  1.1  mrg                                                                (line 15)
   1204  1.1  mrg 
   1205  1.1  mrg 
   1206  1.1  mrg 
   1207  1.1  mrg Tag Table:
   1208  1.1  mrg Node: Top366
   1209  1.1  mrg Ref: gnat-style doc661
   1210  1.1  mrg Ref: 0661
   1211  1.1  mrg Node: General877
   1212  1.1  mrg Ref: gnat-style general965
   1213  1.1  mrg Ref: 1965
   1214  1.1  mrg Ref: gnat-style gnat-coding-style-a-guide-for-gnat-developers965
   1215  1.1  mrg Ref: 2965
   1216  1.1  mrg Node: Lexical Elements1479
   1217  1.1  mrg Ref: gnat-style lexical-elements1586
   1218  1.1  mrg Ref: 31586
   1219  1.1  mrg Node: Character Set and Separators1737
   1220  1.1  mrg Ref: gnat-style character-set-and-separators1842
   1221  1.1  mrg Ref: 41842
   1222  1.1  mrg Node: Identifiers2838
   1223  1.1  mrg Ref: gnat-style identifiers2968
   1224  1.1  mrg Ref: 52968
   1225  1.1  mrg Node: Numeric Literals4041
   1226  1.1  mrg Ref: gnat-style numeric-literals4157
   1227  1.1  mrg Ref: 64157
   1228  1.1  mrg Node: Reserved Words4367
   1229  1.1  mrg Ref: gnat-style reserved-words4480
   1230  1.1  mrg Ref: 74480
   1231  1.1  mrg Node: Comments4698
   1232  1.1  mrg Ref: gnat-style comments4786
   1233  1.1  mrg Ref: 84786
   1234  1.1  mrg Node: Declarations and Types7298
   1235  1.1  mrg Ref: gnat-style declarations-and-types7419
   1236  1.1  mrg Ref: 97419
   1237  1.1  mrg Node: Expressions and Names8898
   1238  1.1  mrg Ref: gnat-style expressions-and-names9013
   1239  1.1  mrg Ref: a9013
   1240  1.1  mrg Node: Statements9541
   1241  1.1  mrg Ref: gnat-style statements9645
   1242  1.1  mrg Ref: b9645
   1243  1.1  mrg Node: Simple and Compound Statements9796
   1244  1.1  mrg Ref: gnat-style simple-and-compound-statements9899
   1245  1.1  mrg Ref: c9899
   1246  1.1  mrg Node: If Statements10149
   1247  1.1  mrg Ref: gnat-style if-statements10276
   1248  1.1  mrg Ref: d10276
   1249  1.1  mrg Node: Case Statements12751
   1250  1.1  mrg Ref: gnat-style case-statements12863
   1251  1.1  mrg Ref: e12863
   1252  1.1  mrg Node: Loop Statements13224
   1253  1.1  mrg Ref: gnat-style loop-statements13339
   1254  1.1  mrg Ref: f13339
   1255  1.1  mrg Node: Block Statements14036
   1256  1.1  mrg Ref: gnat-style block-statements14127
   1257  1.1  mrg Ref: 1014127
   1258  1.1  mrg Node: Subprograms14467
   1259  1.1  mrg Ref: gnat-style subprograms14579
   1260  1.1  mrg Ref: 1114579
   1261  1.1  mrg Node: Subprogram Declarations14668
   1262  1.1  mrg Ref: gnat-style subprogram-declarations14769
   1263  1.1  mrg Ref: 1214769
   1264  1.1  mrg Node: Subprogram Bodies16429
   1265  1.1  mrg Ref: gnat-style subprogram-bodies16530
   1266  1.1  mrg Ref: 1316530
   1267  1.1  mrg Node: Packages and Visibility Rules20266
   1268  1.1  mrg Ref: gnat-style packages-and-visibility-rules20408
   1269  1.1  mrg Ref: 1420408
   1270  1.1  mrg Node: Program Structure and Compilation Issues21431
   1271  1.1  mrg Ref: gnat-style program-structure-and-compilation-issues21567
   1272  1.1  mrg Ref: 1521567
   1273  1.1  mrg Node: GNU Free Documentation License22280
   1274  1.1  mrg Ref: share/gnu_free_documentation_license doc22391
   1275  1.1  mrg Ref: 1622391
   1276  1.1  mrg Ref: share/gnu_free_documentation_license gnu-fdl22391
   1277  1.1  mrg Ref: 1722391
   1278  1.1  mrg Ref: share/gnu_free_documentation_license gnu-free-documentation-license22391
   1279  1.1  mrg Ref: 1822391
   1280  1.1  mrg Node: Index45735
   1281  1.1  mrg 
   1282  1.1  mrg End Tag Table
   1283  1.1  mrg 
   1284  1.1  mrg 
   1285  1.1  mrg Local Variables:
   1286  1.1  mrg coding: utf-8
   1287  1.1  mrg End:
   1288