Command Line for gnatchop (GNAT User’s Guide for Native Platforms)

#### 3.3.6.3 Command Line for `gnatchop` ¶

You call `gnatchop` as follows:

    $ gnatchop switches file_name [file_name ...]
          [directory]

The only required argument is the file name of the file to be chopped. There are no restrictions on the form of this file name. The file itself contains one or more Ada units, in normal GNAT format, concatenated together. As shown, more than one file may be presented to be chopped.

When run in default mode, `gnatchop` generates one output file in the current directory for each unit in each of the files.

`directory`, if specified, gives the name of the directory to which the output files will be written. If you don’t specify it, all files are written to the current directory.

For example, given a file called `hellofiles` containing

    procedure Hello;

    with Ada.Text_IO; use Ada.Text_IO;
    procedure Hello is
    begin
       Put_Line ("Hello");
    end Hello;

the command

    $ gnatchop hellofiles

generates two files in the current directory, one called `hello.ads` containing the single line that is the procedure spec, and the other called `hello.adb` containing the remaining text. The original file is not affected. You can compile these generated files in the normal manner.

When you invoke `gnatchop` on a file that is empty or contains only empty lines and/or comments, `gnatchop` will complete normally, but won’t produce any new file.

For example, given a file called `toto.txt` containing

    --  Just a comment

the command

    $ gnatchop toto.txt

will not produce any new file and will result in the following warnings:

    toto.txt:1:01: warning: empty file, contains no compilation units
    no compilation units found
    no source files written