.-2[NAME]
.-1[SYNOPSIS]
Top
.+1[OPTIONS]
.+2[LANGUAGE OVERVIEW]
.+3[DEFINITION STATEMENTS]
fpp is a preprocessor for Fortran (77, 90, 95) and SFTRAN3, modelled on the ISO Standard C (1989 and 1999) and C++ (1998) preprocessor, but tailored for Fortran use, and for reversibility. The output always contains the complete input, except that some code sections may have become comments, or vice versa. This can be more useful than the non-reversible approach used by the C preprocessor.
Reversible preprocessing is convenient when a master source file must be maintained to generate multiple versions, such as for different operating-system, compiler, and architecture variations. The source code for any of these can serve as the master file to create any of the others.
Although several UNIX vendor Fortran compilers offer to run the C preprocessor, cpp(1), it cannot be used reliably for Fortran code, because it does not know about Fortran line-length limitations, or Fortran syntax. Fortran does not require type declarations, so from syntax confusion, cpp(1) could introduce subtle changes that cannot be detected by the Fortran compiler, and would likely be quite hard to debug.
A similar problem exists with the more general and powerful macro processor, m4(1).
fpp follows the preprocessor syntax defined in three ISO language standards, but embeds directives in comments and restricts its operation, so that both input and output files can be processed by any Fortran compiler, or any other Fortran software tool, such as d2s(1), dtoq(1), dtos(1), fsplit(1), ftnchek(1), pfort(1), pretty(1), qtod(1), s2d(1), sf3lex(1), sf3pretty(1), stod(1), strsf3(1), struct(1), tidy(1), or toolpack(1). Also, a human can see exactly the same post-processed source code that the compiler does.
In particular, this means that it is often possible to apply fpp just once to a set of Fortran source files for a given environment, rather than having to run it each time the code is compiled.
.-2[NAME]
.-1[SYNOPSIS]
Top
.+1[OPTIONS]
.+2[LANGUAGE OVERVIEW]
.+3[DEFINITION STATEMENTS]