Next: , Previous: Pragma Restriction_Warnings, Up: Implementation Defined Pragmas


Pragma Source_File_Name

Syntax:

     pragma Source_File_Name (
       [Unit_Name   =>] unit_NAME,
       Spec_File_Name =>  STRING_LITERAL);
     
     pragma Source_File_Name (
       [Unit_Name   =>] unit_NAME,
       Body_File_Name =>  STRING_LITERAL);

Use this to override the normal naming convention. It is a configuration pragma, and so has the usual applicability of configuration pragmas (i.e. it applies to either an entire partition, or to all units in a compilation, or to a single unit, depending on how it is used. unit_name is mapped to file_name_literal. The identifier for the second argument is required, and indicates whether this is the file name for the spec or for the body.

Another form of the Source_File_Name pragma allows the specification of patterns defining alternative file naming schemes to apply to all files.

     pragma Source_File_Name
       (Spec_File_Name => STRING_LITERAL
        [,Casing => CASING_SPEC]
        [,Dot_Replacement => STRING_LITERAL]);
     
     pragma Source_File_Name
       (Body_File_Name => STRING_LITERAL
        [,Casing => CASING_SPEC]
        [,Dot_Replacement => STRING_LITERAL]);
     
     pragma Source_File_Name
       (Subunit_File_Name => STRING_LITERAL
        [,Casing => CASING_SPEC]
        [,Dot_Replacement => STRING_LITERAL]);
     
     CASING_SPEC ::= Lowercase | Uppercase | Mixedcase

The first argument is a pattern that contains a single asterisk indicating the point at which the unit name is to be inserted in the pattern string to form the file name. The second argument is optional. If present it specifies the casing of the unit name in the resulting file name string. The default is lower case. Finally the third argument allows for systematic replacement of any dots in the unit name by the specified string literal.

A pragma Source_File_Name cannot appear after a Pragma Source_File_Name_Project.

For more details on the use of the Source_File_Name pragma, see the sections “Using Other File Names” and “Alternative File Naming Schemes” in the GNAT User's Guide.