next up previous 211
Next: extmk - Modify mk file for use with EXTREME data sets
Up: Description of tools
Previous: frepint - Replace INTEGER by INTEGER*8 in Fortran 77


inscnf - Wrap %VAL arguments with CNF_PVAL in Fortran 77

Description:
This is a filter which takes FORTRAN 77 source code and modifies it so that text which is the argument of a %VAL directive is wrapped in a call to CNF_PVAL; i.e. input text

%VAL( IPTR )

is changed to

%VAL( CNF_PVAL( IPTR ) )

If the call to CNF_PVAL is already present no change is made, and a warning is emitted. Lines with no references to the %VAL directive are left alone.

Additionally, for each program unit in which a call to CNF_PVAL has been made, an attempt is made to insert a line like

INCLUDE 'CNF_PAR' ! For CNF_PVAL function

This is inserted after the last INCLUDE line which already exists in the program unit. If there are no INCLUDE lines there, this line is not inserted, and a warning message is printed to standard error.

Attention is paid to Fortran 77 source format, so that lines more than 72 characters long are avoided (unless they were there in the first place).

Characters '$\backslash$r' (carriage return) and '$\backslash$t' (tab) might possibly cause erroneous line breaking - if any are encountered a warning is given (these should not be in the source really). Code using columns 73-80 of the source cards for comments is likely to be mangled (nobody does this any more do they?).

Under certain improbable circumstances it is possible for the program to get stuck trying to break a line; in this case it will exit with error status and an error message.

Some attention is paid to the aesthetic qualities of the output: line breaks are made, where possible, following the usage in, e.g., KAPPA. An attempt is made to copy the style of case usage and bracket spacing from the input.

This program wraps ALL occurrences of %VAL in a call to CNF_PVAL, unless they are already so wrapped. If it suspects that %VAL may not be a legitimate candidate for this treatment, it will output a warning message to standard error. It will do this in the following cases:

  • %VAL is on the last argument in the argument list (this suggests that it might be a trailing string length)

  • The argument of %VAL looks like an integer constant

  • The argument of %VAL looks like a Starlink-style symbolic constant (has two adjacent underscore characters).


Usage:
inscnf [ in [ out ] ]

Notes:
Although this program behaves as a filter, it is written on the assumption that it will be run on a file of a finite length: it may buffer large amounts of input before writing output, and it may not free up memory.


next up previous 211
Next: extmk - Modify mk file for use with EXTREME data sets
Up: Description of tools
Previous: frepint - Replace INTEGER by INTEGER*8 in Fortran 77


Starlink System Note 73
Mark Taylor
13 August 2001
E-mail:ussc@star.rl.ac.uk

Copyright © 2001 Council for the Central Laboratory of the Research Councils