Specifying the Source File

From InterBase

Go Up to Preprocessing


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:

  1. It looks for the input file without an extension. If gpre finds the file, it processes it and generates an output file with the appropriate extension. If gpre does 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.
  2. If gpre cannot 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 gpre command. <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:

  1. It looks for a file called census without an extension. If it finds the file, it processes it and generates census.c.
  2. If it cannot find census, it looks for a file called census.e. If it finds census.e, it processes the file and generates census.c.
  3. If it cannot find census or census.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:

  1. filename.e (C)
  2. filename.epas (Pascal)
  3. filename.ef (FORTRAN)
  4. filename.ecob (COBOL)
  5. filename.ea (VERDIX Ada)
  6. 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.

Advance To: