F2C(1)
π NAME π
okay so this is F2C(1) β the f2c page β from the General Commands Manual, and it's literally here to convert Fortran 77 into C or C++ π
f2c β Convert Fortran 77 to C or C++.
β¨ SYNOPSIS β¨
f2c [ option ... ] file ...
π¦ DESCRIPTION π¦
F2c converts Fortran 77 source code in files with names ending in .f or .F to C (or C++) source files in the current directory, with .c substituted for the final .f 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 .p or .P 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).
π Same-Meaning-as-f77(1) Options π
-Cβ Compile code to check that subscripts are within declared array bounds.-I2β RenderINTEGERandLOGICALasshort,INTEGERβ4aslong int. Assume the defaultlibF77andlibI77: allow onlyINTEGERβ4(and noLOGICAL) variables in INQUIREs. Option-I4confirms the default rendering ofINTEGERaslong int.-Idirβ Look for a non-absolute include file first in the directory of the current input file, then in directories specified by-Ioptions (one directory per option). Options-I2and-I4have precedence, so, e.g., a directory named2should be specified by-I./2.-onetripβ 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.)-Uβ Honor the case of variable and external names. Fortran keywords must be in lower case.-uβ Make the default type of a variableundefinedrather than using the default Fortran rules.-wβ Suppress all warning messages, or, if the option is-w66, just Fortran 66 compatibility warnings.
The following options are peculiar to f2c.
π§ Peculiar-to-f2c Options π§
-Aβ Produce ANSI C (default, starting 20020621). For old-style C, use option-K.-aβ Make local variables automatic rather than static unless they appear in a DATA, EQUIVALENCE, NAMELIST, or SAVE statement.-C++β Output C++ code.-cβ Include original Fortran source as comments.-cdβ Do not recognizecdabs,cdcos,cdexp,cdlog,cdsin, andcdsqrtas synonyms for the double complex intrinsicszabs,zcos,zexp,zlog,zsin, andzsqrt, respectively, nordrealas a synonym fordble.-ddirβ Write.cfiles in directory dir instead of the current directory.-Eβ Declare uninitialized COMMON to be Extern (overridably defined inf2c.hasextern).-ecβ Place uninitialized COMMON blocks in separate files:COMMON /ABC/appears in fileabc_com.c. Option-e1cbundles the separate files into the output file, with comments that give an unbundlingsed(1)script.-extβ Complain aboutf77(1)extensions.-fβ Assume free-format input: accept text after column 72 and do not pad fixed-format lines shorter than 72 characters with blanks.-72β Treat text appearing after column 72 as an error.-gβ Include original Fortran line numbers in#linelines.-hβ Emulate Fortran 66's treatment of Hollerith: try to align character strings on word (or, if the option is-hd, on double-word) boundaries.-i2β Similar to-I2, but assume a modifiedlibF77andlibI77(compiled with-Df2c_i2), soINTEGERandLOGICALvariables may be assigned by INQUIRE and array lengths are stored inshort ints.-i90β Do not recognize the Fortran 90 bit-manipulation intrinsicsbtest,iand,ibclr,ibits,ibset,ieor,ior,ishft, andishftc.-krβ 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.-Pβ Write afile.Pof ANSI (or C++) prototypes for definitions in each inputfile.forfile.F. When reading Fortran from standard input, write prototypes at the beginning of standard output. Option-Psimplies-Pand gives exit status4if rerunningf2cmay change prototypes or declarations.-pβ Supply preprocessor definitions to make common-block members look like local variables.-Rβ Do not promote REAL functions and operations to DOUBLE PRECISION. Option-!Rconfirms the default, which imitatesf77.-rβ Cast REAL arguments of intrinsic functions and values of REAL functions (including intrinsics) to REAL.-r8β Promote REAL to DOUBLE PRECISION, COMPLEX to DOUBLE COMPLEX.-sβ Preserve multidimensional subscripts. Suppressed by option-C.-Tdirβ Put temporary files in directory dir.-trapuvβ Dynamically initialize local variables, except those appearing in SAVE or DATA statements, with values that may help find references to uninitialized variables. For example, with IEEE arithmetic, initialize local floating-point variables to signaling NaNs.-w8β Suppress warnings when COMMON or EQUIVALENCE forces odd-word alignment of doubles.-Wnβ Assume n characters/word (default 4) when initializing numeric variables with character data.-zβ Do not implicitly recognize DOUBLE COMPLEX.-!bsβ Do not recognize backslash escapes (\",\',\0,\\,\b,\f,\n,\r,\t,\v) in character strings.-!cβ Inhibit C output, but produce-Poutput.-!Iβ Reject include statements.-!i8β DisallowINTEGER*8, or, if the option is-!i8const, permitINTEGER*8but do not promote integer constants toINTEGER*8when they involve more than 32 bits.-!itβ Don't infer types of untyped EXTERNAL procedures from use as parameters to previously defined or prototyped procedures.-!Pβ Do not attempt to infer ANSI or C++ prototypes from usage.
The resulting C invokes the support routines of f77; object code should be loaded by f77 or with ld(1) or cc(1) options -lF77 -lI77 -lm. Calling conventions are those of f77: see the reference below.
π FILES π
file.[fF]β input file*.cβ output file/usr/include/f2c.hβ header file/usr/lib/libF77.aβ intrinsic function library/usr/lib/libI77.aβ Fortran I/O library/lib/libc.aβ C library, see section 3
π₯ SEE ALSO π₯
S. I. Feldman and P. J. Weinberger, A Portable Fortran 77 Compiler, UNIX Time Sharing System Programmer's Manual, Tenth Edition, Volume 2, AT&T Bell Laboratories, 1990.
π DIAGNOSTICS π
The diagnostics produced by f2c are intended to be self-explanatory.
π BUGS π
- Floating-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. - Untypable EXTERNAL functions are declared
int. - There is no notation for
INTEGER*8constants. - Some intrinsic functions do not yet work with
INTEGER*8.
π aaaand that's the whole F2C(1) page from the General Commands Manual β the footer/source-version-date slot is literally just the classic F2C(1) stamp, no extra source/version/date text to spill, periodt. πβ¨
π¦ where this page comes from
- epel 9: f2c 20210928-3.el9 Β· MIT
- fedora 43: f2c 20210928-11.fc43 Β· MIT
- fedora 44: f2c 20210928-12.fc44 Β· MIT
- opensuse-leap 16.0: f2c 20210928-bp160.1.13 Β· MIT
- opensuse-leap 16.0: f2c 20210928-bp160.1.13 Β· MIT
- opensuse-leap 16.0: f2c 20210928-bp160.1.13 Β· MIT
- opensuse-leap 16.0: f2c 20210928-bp160.1.13 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms