NAMEf2c - Convert Fortran 77 to C or C++
SYNOPSISf2c [ option ... ] file ...
DESCRIPTIONF2c converts Fortran 77 source code in files with names ending in or to C (or C++) source files in the current directory, with substituted for the final or `.F'. If no Fortran files are named, f2c reads Fortran from standard input and writes C on standard output. File names that end with or are taken to be prototype files, as produced by option `-P', and are read first.
The following options have the same meaning as in f77(1).
- Compile code to check that subscripts are within declared array bounds.
- Render INTEGER and LOGICAL as short, INTEGER*4 as long int. Assume the default libF77 and libI77: allow only INTEGER*4 (and no LOGICAL) variables in INQUIREs. Option confirms the default rendering of INTEGER as long int.
- Look for a non-absolute include file first in the directory of the current input file, then in directories specified by -I options (one directory per option). Options -I2 and -I4 have precedence, so, e.g., a directory named 2 should be specified by -I./2 .
- Compile DO loops that are performed at least once if reached. (Fortran 77 DO loops are not performed at all if the upper limit is smaller than the lower limit.)
- Honor the case of variable and external names. Fortran keywords must be in lower case.
- Make the default type of a variable `undefined' rather than using the default Fortran rules.
- Suppress all warning messages, or, if the option is `-w66', just Fortran 66 compatibility warnings.
The following options are peculiar to f2c.
ANSIC (default, starting 20020621). For old-style C, use option -K.
Make local variables automatic rather than static
unless they appear in a
DATA, EQUIVALENCE, NAMELIST,orSAVEstatement.
- Output C++ code.
- Include original Fortran source as comments.
- Do not recognize cdabs, cdcos, cdexp, cdlog, cdsin, and cdsqrt as synonyms for the double complex intrinsics zabs, zcos, zexp, zlog, zsin, and zsqrt, respectively, nor dreal as a synonym for dble.
- Write files in directory dir instead of the current directory.
COMMONto be Extern (overridably defined in as extern).
COMMONblocks in separate files: COMMON /ABC/ appears in file abc_com.c. Option `-e1c' bundles the separate files into the output file, with comments that give an unbundling sed(1) script.
- Complain about f77(1) extensions.
- Assume free-format input: accept text after column 72 and do not pad fixed-format lines shorter than 72 characters with blanks.
- Treat text appearing after column 72 as an error.
- Include original Fortran line numbers in #line lines.
- Emulate Fortran 66's treatment of Hollerith: try to align character strings on word (or, if the option is `-hd', on double-word) boundaries.
but assume a modified
INTEGERandLOGICALvariables may be assigned byINQUIREand array lengths are stored in short ints.
- Do not recognize the Fortran 90 bit-manipulation intrinsics btest, iand, ibclr, ibits, ibset, ieor, ior, ishft, and ishftc.
- Use temporary values to enforce Fortran expression evaluation where K&R (first edition) parenthesization rules allow rearrangement. If the option is `-krd', use double precision temporaries even for single-precision operands.
- Write a file.P of ANSI (or C++) prototypes for definitions in each input file.f or file.F. When reading Fortran from standard input, write prototypes at the beginning of standard output. Option -Ps implies -P and gives exit status 4 if rerunning f2c may change prototypes or declarations.
- Supply preprocessor definitions to make common-block members look like local variables.
Do not promote
REALfunctions and operations toDOUBLE PRECISION.Option confirms the default, which imitates f77.
- Cast REAL arguments of intrinsic functions and values of REAL functions (including intrinsics) to REAL.
REALtoDOUBLE PRECISION, COMPLEXtoDOUBLE COMPLEX.
- Preserve multidimensional subscripts. Suppressed by option .
- Put temporary files in directory dir.
Dynamically initialize local variables, except those appearing in
SAVEorDATAstatements, with values that may help find references to uninitialized variables. For example, with IEEE arithmetic, initialize local floating-point variables to signaling NaNs.
Suppress warnings when
COMMONorEQUIVALENCEforces odd-word alignment of doubles.
- Assume n characters/word (default 4) when initializing numeric variables with character data.
Do not implicitly recognize
- Do not recognize backslash escapes (\", \', \0, \\, \b, \f, \n, \r, \t, \v) in character strings.
- Inhibit C output, but produce -P output.
- Reject include statements.
INTEGER*8 ,or, if the option is `-!i8const', permitINTEGER*8but do not promote integer constants toINTEGER*8when they involve more than 32 bits.
Don't infer types of untyped
EXTERNALprocedures from use as parameters to previously defined or prototyped procedures.
Do not attempt to infer
ANSIor C++ prototypes from usage.
- -v, --version
- Print the version number of f2c
- file.[fF] input file
- output file
- header file
- static link intrinsic and I/O library
- static link intrinsic and I/O library for use with files translated using the -i2 f2c option
- shared object intrinsic and I/O library
- shared object intrinsic and I/O library for use with files translated using the -i2 f2c option
DIAGNOSTICSThe diagnostics produced by f2c are intended to be self-explanatory.
BUGSFloating-point constant expressions are simplified in the floating-point arithmetic of the machine running f2c, so they are typically accurate to at most 16 or 17 decimal places.
EXTERNALfunctions are declared int.
There is no notation for
Some intrinsic functions do not yet work with