This chapter discusses how to handle files with multiple units by using the gnatchop utility. This utility is also useful in renaming files to meet the standard ERC32 Ada default file naming conventions.
The basic compilation model of ERC32 Ada requires a file submitted to the compiler have only one unit and there must be a strict correspondence between the file name and the unit name.
The gnatchop utility allows both of these rules to be relaxed, allowing ERC32 Ada to process files which contain multiple compilation units and files with arbitrary file names. The approach used by gnatchop is to read the specified file and generate one or more output files, containing one unit per file and with proper file names as required by ERC32 Ada.
If you want to permanently restructure a set of foreign files so that they match the ERC32 Ada rules and do the remaining development using the ERC32 Ada structure, you can simply use gnatchop once, generate the new set of files and work with them from that point on.
Alternatively, if you want to keep your files in the foreign format, perhaps to maintain compatibility with some other Ada compilation system, you can set up a procedure where you use gnatchop each time you compile, regarding the source files that it writes as temporary files that you throw away.