3 FORCONV

The principal job of FORCONV is to convert the file name specification in Fortran include statements but it will also do some other routine tasks that are necessary when converting a program from VMS to UNIX.

The substitution of include file names is driven by a “substitution file” which lists the VMS file specifications and their equivalent UNIX file names, one pair per line. For example the file might contain:

  PARS.FOR pars
  INCLIB(COMMON) commons

and an example of the source code to be converted might be:

        INCLUDE ’PARS.FOR’
        INCLUDE ’INCLIB(COMMON)’

which, after processing, would be changed to:

        INCLUDE ’pars’
        INCLUDE ’commons’

The case of the VMS file specification is ignored when trying to find a match and spaces are ignored in the file specification in the INCLUDE statement.

If a match for an include file specification is not found then the name is folded to lower case and a prefix prepended; the default prefix is /star/include/ but this can be changed with the -p command line option. So in the above example:

  INCLUDE ’FRED’

would be converted to:

  INCLUDE ’/star/include/fred’

As a result of this, when converting programs that use Starlink libraries, the substitution file need only specify any “program-specific” include files; references to Starlink include files will all be converted automatically. If the program does not use Starlink libraries, then the prefix can be suppressed entirely by specifying the -p option with an empty string.

The program will not recognise INCLUDE statements that are continued on to a new line.

The command:

  forconv

Will read from the standard input stream and write to the standard output stream, and will use include.sub as the name of the substitution file. The program’s behaviour can be modified with the following UNIX-style command options:

-ifilename
Read from filename instead of the standard input stream. Note that there is no space between the i and the file name in this or any other command options.
-ofilename
Write to filename instead of the standard output stream.
-sfilename
Use filename as the substitution file.
-mfilename
Generate a skeleton make file. If filename is omitted a file called makefile will be written.
-bname
Use name as the target in the dependency rules written to the make file. In the absence of -b the name module is used.
-pprefix
Use prefix as the string to be inserted before all file specifications that did not match a file specification in the substitution file. The default prefix is /star/include/; -p on its own specifies no prefix.
-h
Add
  INCLUDE ’/star/include/dat_par’

after every occurrence of ’/star/include/sae_par’. This compensates for an incompatibility between the standard Starlink include file sae_par on VMS and on UNIX and is required if the program being converted uses any DAT__ constants.

-j
Add
  INCLUDE ’/star/include/par_par’

after every occurrence of ’/star/include/sae_par’. This compensates for an incompatibility between the standard Starlink include file sae_par on VMS and on UNIX and is required if the program being converted uses any PAR__ constants.

-q
Suppress all informational messages. By default the program writes a message to the standard error stream each time it process an INCLUDE statement.