Next: , Previous: The Cross-Referencing Tools gnatxref and gnatfind, Up: Top


14 The GNAT Pretty-Printer gnatpp

The gnatpp tool is an ASIS-based utility for source reformatting / pretty-printing. It takes an Ada source file as input and generates a reformatted version as output. You can specify various style directives via switches; e.g., identifier case conventions, rules of indentation, and comment layout.

To produce a reformatted file, gnatpp generates and uses the ASIS tree for the input source and thus requires the input to be syntactically and semantically legal. If this condition is not met, gnatpp will terminate with an error message; no output file will be generated.

If the source files presented to gnatpp contain preprocessing directives, then the output file will correspond to the generated source after all preprocessing is carried out. There is no way using gnatpp to obtain pretty printed files that include the preprocessing directives.

If the compilation unit contained in the input source depends semantically upon units located outside the current directory, you have to provide the source search path when invoking gnatpp, if these units are contained in files with names that do not follow the GNAT file naming rules, you have to provide the configuration file describing the corresponding naming scheme; see the description of the gnatpp switches below. Another possibility is to use a project file and to call gnatpp through the gnat driver (see The GNAT Driver and Project Files).

The gnatpp command has the form

     
     
     $ gnatpp [switches] filename [-cargs gcc_switches]

where