Next: , Previous: Arbitrary File Naming Conventions, Up: Handling Arbitrary File Naming Conventions Using gnatname


10.2 Running gnatname

The usual form of the gnatname command is

     $ gnatname [switches] naming_pattern [naming_patterns]
           [--and [switches] naming_pattern [naming_patterns]]

All of the arguments are optional. If invoked without any argument, gnatname will display its usage.

When used with at least one naming pattern, gnatname will attempt to find all the compilation units in files that follow at least one of the naming patterns. To find these compilation units, gnatname will use the GNAT compiler in syntax-check-only mode on all regular files.

One or several Naming Patterns may be given as arguments to gnatname. Each Naming Pattern is enclosed between double quotes. A Naming Pattern is a regular expression similar to the wildcard patterns used in file names by the Unix shells or the DOS prompt.

gnatname may be called with several sections of directories/patterns. Sections are separated by switch --and. In each section, there must be at least one pattern. If no directory is specified in a section, the current directory (or the project directory is -P is used) is implied. The options other that the directory switches and the patterns apply globally even if they are in different sections.

Examples of Naming Patterns are

        "*.[12].ada"
        "*.ad[sb]*"
        "body_*"    "spec_*"

For a more complete description of the syntax of Naming Patterns, see the second kind of regular expressions described in g-regexp.ads (the “Glob” regular expressions).

When invoked with no switch -P, gnatname will create a configuration pragmas file gnat.adc in the current working directory, with pragmas Source_File_Name for each file that contains a valid Ada unit.