[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gnatname
10.1 Arbitrary File Naming Conventions 10.2 Running gnatname
10.3 Switches for gnatname
10.4 Examples of gnatname
Usage
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The GNAT compiler must be able to know the source file name of a compilation
unit. When using the standard GNAT default file naming conventions
(.ads
for specs, .adb
for bodies), the GNAT compiler
does not need additional information.
When the source file names do not follow the standard GNAT default file naming
conventions, the GNAT compiler must be given additional information through
a configuration pragmas file (see section 9. Configuration Pragmas)
or a project file.
When the non standard file naming conventions are well-defined,
a small number of pragmas Source_File_Name
specifying a naming pattern
(see section 2.5 Alternative File Naming Schemes) may be sufficient. However,
if the file naming conventions are irregular or arbitrary, a number
of pragma Source_File_Name
for individual compilation units
must be defined.
To help maintain the correspondence between compilation unit names and
source file names within the compiler,
GNAT provides a tool gnatname
to generate the required pragmas for a
set of files.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gnatname
The usual form of the gnatname
command is
$ gnatname [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.
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 switches, 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.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gnatname
Switches for gnatname
must precede any specified Naming Pattern.
You may specify any of the following switches to gnatname
:
gnatname -Pprj -f"*.c" "*.ada" |
gnatname -x "*_nt.ada" "*.ada" |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gnatname
Usage
$ gnatname -c /home/me/names.adc -d sources "[a-z]*.ada*" |
In this example, the directory `/home/me' must already exist and be writable. In addition, the directory `/home/me/sources' (specified by `-d sources') must exist and be readable.
Note the optional spaces after `-c' and `-d'.
$ gnatname -P/home/me/proj -x "*_nt_body.ada" -dsources -dsources/plus -Dcommon_dirs.txt "body_*" "spec_*" |
Note that several switches `-d' may be used, even in conjunction with one or several switches `-D'. Several Naming Patterns and one excluded pattern are used in this example.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |