Next: Library Projects, Previous: Variables from Imported Projects, Up: GNAT Project Manager
Sometimes an Ada software system is ported from a foreign compilation
environment to GNAT, and the file names do not use the default GNAT
conventions. Instead of changing all the file names (which for a variety
of reasons might not be possible), you can define the relevant file
naming scheme in the Naming
package in your project file.
Note that the use of pragmas described in Alternative File Naming Schemes by mean of a configuration pragmas file is not supported when using project files. You must use the features described in this paragraph. You can however use specify other configuration pragmas (see Specifying Configuration Pragmas).
For example, the following package models the Apex file naming rules:
package Naming is for Casing use "lowercase"; for Dot_Replacement use "."; for Spec_Suffix ("Ada") use ".1.ada"; for Body_Suffix ("Ada") use ".2.ada"; end Naming;
You can define the following attributes in package Naming
:
"lowercase"
,
"uppercase"
or "mixedcase"
; these strings are case insensitive.
If Casing is not specified, then the default is "lowercase"
.
'.'
except if the entire string
is "."
If Dot_Replacement
is not specified, then the default is "-"
.
Spec_Suffix ("Ada")
is not specified, then the default is
".ads"
.
Spec_Suffix ("Ada")
Body_Suffix ("Ada")
is not specified, then the default is
".adb"
.
Body_Suffix
.
If Separate_Suffix ("Ada")
is not specified, then it defaults to same
value as Body_Suffix ("Ada")
.
Spec
to define
the source file name for an individual Ada compilation unit's spec. The array
index must be a string literal that identifies the Ada unit (case insensitive).
The value of this attribute must be a string that identifies the file that
contains this unit's spec (case sensitive or insensitive depending on the
operating system).
for Spec ("MyPack.MyChild") use "mypack.mychild.spec";
Body
to
define the source file name for an individual Ada compilation unit's body
(possibly a subunit). The array index must be a string literal that identifies
the Ada unit (case insensitive). The value of this attribute must be a string
that identifies the file that contains this unit's body or subunit (case
sensitive or insensitive depending on the operating system).
for Body ("MyPack.MyChild") use "mypack.mychild.body";