Next: Switches for gnatchop, Previous: Operating gnatchop in Compilation Mode, Up: Renaming Files Using gnatchop
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 Text_IO; use 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