gnatchop
¶The gnatchop
command has the form:
$ 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 it is not specified, 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. The generated files can be compiled in
the normal manner.
When gnatchop is invoked on a file that is empty or that contains only empty lines and/or comments, gnatchop will not fail, but will not produce any new sources.
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