Next: , Previous: Variables from Imported Projects, Up: GNAT Project Manager


10.10 Naming Schemes

Sometimes an Ada software system is ported from a foreign compilation environment to GNAT, with file names that 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. For example, the following package models the Apex file naming rules:

       package Naming is
         for Casing                        use "lowercase";
         for Dot_Replacement               use ".";
         for Specification_Suffix ("Ada")  use ".1.ada";
         for Implementation_Suffix ("Ada") use ".2.ada";
       end Naming;

You can define the following attributes in package Naming:

Casing
This must be a string with one of the three values "lowercase", "uppercase" or "mixedcase"; these strings are case insensitive.

If Casing is not specified, then the default is "lowercase".

Dot_Replacement
This must be a string whose value satisfies the following conditions:

If Dot_Replacement is not specified, then the default is "-".

Specification_Suffix
This is an associative array (indexed by the programming language name, case insensitive) whose value is a string that must satisfy the following conditions: If Specification_Suffix ("Ada") is not specified, then the default is ".ads".
Implementation_Suffix
This is an associative array (indexed by the programming language name, case insensitive) whose value is a string that must satisfy the following conditions: If Implementation_Suffix ("Ada") is not specified, then the default is ".adb".
Separate_Suffix
This must be a string whose value satisfies the same conditions as Implementation_Suffix.

If Separate_Suffix ("Ada") is not specified, then it defaults to same value as Implementation_Suffix ("Ada").

Specification
You can use the Specification attribute, an associative array, 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 Specification ("MyPack.MyChild") use "mypack.mychild.spec";
     

Implementation
You can use the Implementation attribute, an associative array, 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 Implementation ("MyPack.MyChild") use "mypack.mychild.body";