Specifying the Source File
Go Up to Preprocessing
Contents
Because both the language switch and the filename extension are optional, gpre can encounter three different situations:
- A language switch and input file with no extension
- No language switch, but an input file with extension
- Neither a language switch, nor a file extension
This section describes gpre’s behavior in each of these cases.
Language Switch and No Input File Extension
If gpre encounters a language switch, but the specified input file has no extension, it does the following:
- It looks for the input file without an extension. If
gprefinds the file, it processes it and generates an output file with the appropriate extension. Ifgpredoes not find the input file, it looks for the file with the extension that corresponds to the indicated language. If it finds such a file, it generates an output file with the appropriate extension. - If
gprecannot find either the named file or the named file with the appropriate extension, it returns the following error:gpre: can’t open filename or filename.extension
<filename> is the file specified in the
gprecommand. <extension> is the language-specific file extension for the specified program.
An Example:
Suppose the following command is issued:
gpre -c census
gpre performs the following sequence of actions:
- It looks for a file called
censuswithout an extension. If it finds the file, it processes it and generatescensus.c. - If it cannot find
census, it looks for a file calledcensus.e. If it findscensus.e, it processes the file and generatescensus.c. - If it cannot find
censusorcensus.e, it returns this error:
gpre: can’t open census or census.e
An Input File with Extension by No Language Switch
If a language switch is not specified, but the input file includes a file-name extension, gpre looks for the specified file and assumes the language is indicated by the extension.
For example, suppose the following command is processed:
gpre census.e
gpre looks for a file called census.e. If gpre finds this file, it processes it as a C program and generates an output file called census.c. If gpre does not find this file, it returns the following error:
gpre: can’t open census.e
Neither a Language Switch Nor a File Extension
If gpre finds neither a language extension nor a filename extension, it looks for a file in the following order:
filename.e(C)filename.epas(Pascal)filename.ef(FORTRAN)filename.ecob(COBOL)filename.ea(VERDIXAda)filename.eada(Alsys, and Telesoft Ada)
If gpre finds such a file, it generates an output file with the appropriate extension. If gpre does not find the file, it returns the following error:
gpre: can’t find filename with any known extension. Giving up.