Chapter 7. Shortening File Names with gnatkr

Table of Contents
7.1. About gnatkr
7.2. Using gnatkr
7.3. Crunching Method
7.4. Examples of gnatkr Usage

This chapter discusses the method used by the compiler to shorten the default file names chosen for Ada units so that they do not exceed the maximum length permitted, and also describes the gnatkr utility that can be used to determine the result of applying this shortening.

7.1. About gnatkr

The normal rule in using XGC Ada if default file names are used is that the file name must be derived from the unit name. The exact default rule is: Take the unit name and replace all dots by hyphens, except that if such a replacement occurs in the second character position of a name and the first character is one of a/g/s/i then replace the dot by the character ~ (tilde) instead of a minus. The reason for this special exception is to avoid clashes with the standard names for children of System, Ada and Interfaces, which use the prefixes -s -a and -i respectively.

The -gnatknn switch of the compiler activates a "crunching" circuit that limits file names to nn characters (where nn is a decimal integer). For example, using OpenVMS, where the maximum file name length is 63, the value of nn is usually set to 63, but if you want to generate a set of files that would be usable if ported to a system with some different maximum file length, then a different value might be appropriate. The default value of 63 for OpenVMS need not be specified.

The gnatkr utility can be used to determine the crunched name for a given file, when crunched to a specified maximum length.