PowerAda afmt

From OC Systems Wiki!
< PowerAda:APPENDIX E. Tools Reference
Revision as of 00:35, 25 April 2019 by imported>WikiVisor (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


afmt - format Ada source


afmt [-h] [-i Case] [-r Case]
     [-n Indentation] 
     [-s] [-c] [-w]
     [-d | -b]
     {-I | FileName  . . . }


The PowerAda source formatter can convert Ada source to use different indentation, spacing, and conventions for use of upper- and lowercase. The PowerAda source formatter takes as input Ada source from a file or from standard input. The formatted source is written to standard output.

By default, afmt simply passes the Ada source without modification. It optionally indents control structures by a specified amount, spaces lexical elements according to the Ada95 style guidelines, and changes the case of lexical elements according to one of several styles. No semantic changes are made to the source.

If the input text is not correct Ada source code, afmt produces unpredictable output. Make sure that you only use afmt to format syntactically correct Ada source.


-i Case
Specifies the case convention to be used for identifiers (other than reserved words). If this option is not specified (when you invoke the afmt command and within any specified control file), the default convention is lowercase.
-r Case
Specifies the case convention to be used for reserved words. If this option is not specified (when invoking the afmt command and within any specified control file), the default convention is mixed.
Case can be any unique abbreviation of one of the following:
firstupper Only the first letter of each identifier or reserved word will be uppercase. All other letters are lowercase.
mixed The first letter of each identifier or reserved word and every letter following an underscore will be in uppercase - other letters will be in lowercase.
lowercase All letters will be lowercase.
uppercase All letters will be uppercase.
same Identifiers or reserved words will appear the same as they did in the original source.
Note that since no reserved words contain an underscore character, for reserved words the mixed convention is the same as the firstupper convention.


Requests help for the command. If specified, all other options and parameters (except possibly erroneous ones) are ignored. The program writes a brief help message to standard output.
Changes the case of identifiers and reserved words according to -i and -r.
Changes spacing between lexical elements according to Ada95 style guidelines.
-n Indentation
Defines the amount of indentation. The default is 2.
Changes the indentation of the control structures according to the Ada95 style guidelines using indentation increments as specified by -n. May not be used with -b.
Changes the indentation of control structures according to a "box rule" which adapts to the indentation level of existing code. May not be used with -d.
Enables wide-character source encodings in the Ada source.
Causes the source formatter to read from standard input a list of file names, then format each of the files in the list. When you specify this option, you cannot specify any file names on the command line. The list of file names can contain lines with "--" in them; the source formatter ignores the remainder of the line after the "--".


FileName . . .
Specifies the file(s) to be formatted. You can enter as many file names here as you like.
If you specify a hyphen ("-") as one of the file names, the source formatter reads Ada source from standard input instead of from a file.


Below is a list of the possible values returned by the source formatter. Refer to Return Codes for Commands for details about the meaning of these return s.

0, 1, 2, 13, 14, 99


$POWERADA/bin/afmt - the afmt program




See Problems and Questions at the beginning of this Appendix.