A.3. File Naming Rules

The default file name is determined by the name of the unit the file contains. The name is formed by taking the full expanded name of the unit and replacing the separating dots with hyphens and using lowercase for all letters.

A special exception arises if the file name according to the above rules has one of the characters a,g,i, or s and the second character is a minus. In this case, the character /tilde/dollar sign/ is used in place of the The reason for this special exception is to avoid clashes with the standard names for children of System, Ada, Interfaces, and XGC Ada, which use the prefixes -s -a -i and -g respectively.

The extension is .ads for a spec and .adb for a body. The following table shows some examples of these rules.

main.ads

Main (spec)

main.adb

Main (body)

arith_functions.ads

Arith_Functions (package spec)

arith_functions.adb

Arith_Functions (package body)

func-spec.ads

Func.Spec (child package spec)

func-spec.adb

Func.Spec (child package body)

main-sub.adb

Sub (subunit of Main)

a~bad.adb

A.Bad (child package body)

Following these rules can result in excessively long file names if corresponding unit names are long (for example, if child units or subunits are heavily nested). An option is available to shorten such long file names (called file name "krunching"). This may be particularly useful when programs being developed with XGC Ada are to be used on operating systems with limited file name lengths. See Section 7.2.

Of course, no file shortening algorithm can guarantee uniqueness over all possible unit names; if file name krunching is used it is your responsibility to ensure no name clashes occur, or alternatively you can specify the exact file names that you want to be used, as described in the next section.