1 2 F2C(1) UNIX System V F2C(1) 3 4 NAME 5 f2c - Convert Fortran 77 to C or C++ 6 7 SYNOPSIS 8 f2c [ option ... ] file ... 9 10 DESCRIPTION 11 F2c converts Fortran 77 source code in files with names end- 12 ing in `.f' or `.F' to C (or C++) source files in the cur- 13 rent directory, with `.c' substituted for the final `.f' or 14 `.F'. If no Fortran files are named, f2c reads Fortran from 15 standard input and writes C on standard output. File names 16 that end with `.p' or `.P' are taken to be prototype files, 17 as produced by option `-P', and are read first. 18 19 The following options have the same meaning as in f77(1). 20 21 -C Compile code to check that subscripts are within 22 declared array bounds. 23 24 -I2 Render INTEGER and LOGICAL as short, INTEGER*4 as long 25 int. Assume the default libF77 and libI77: allow only 26 INTEGER*4 (and no LOGICAL) variables in INQUIREs. 27 Option `-I4' confirms the default rendering of INTEGER 28 as long int. 29 30 -Idir 31 Look for a non-absolute include file first in the 32 directory of the current input file, then in directo- 33 ries specified by -I options (one directory per 34 option). Options -I2 and -I4 have precedence, so, 35 e.g., a directory named 2 should be specified by -I./2 36 . 37 38 -onetrip 39 Compile DO loops that are performed at least once if 40 reached. (Fortran 77 DO loops are not performed at all 41 if the upper limit is smaller than the lower limit.) 42 43 -U Honor the case of variable and external names. Fortran 44 keywords must be in lower case. 45 46 -u Make the default type of a variable `undefined' rather 47 than using the default Fortran rules. 48 49 -w Suppress all warning messages, or, if the option is 50 `-w66', just Fortran 66 compatibility warnings. 51 52 The following options are peculiar to f2c. 53 54 -A Produce ANSI C. Default is old-style C. 55 56 Page 1 (printed 5/12/96) 57 58 F2C(1) UNIX System V F2C(1) 59 60 -a Make local variables automatic rather than static 61 unless they appear in a DATA, EQUIVALENCE, NAMELIST, or 62 SAVE statement. 63 64 -C++ Output C++ code. 65 66 -c Include original Fortran source as comments. 67 68 -cd Do not recognize cdabs, cdcos, cdexp, cdlog, cdsin, and 69 cdsqrt as synonyms for the double complex intrinsics 70 zabs, zcos, zexp, zlog, zsin, and zsqrt, respectively. 71 72 -ddir 73 Write `.c' files in directory dir instead of the cur- 74 rent directory. 75 76 -E Declare uninitialized COMMON to be Extern (overridably 77 defined in f2c.h as extern). 78 79 -ec Place uninitialized COMMON blocks in separate files: 80 COMMON /ABC/ appears in file abc_com.c. Option `-e1c' 81 bundles the separate files into the output file, with 82 comments that give an unbundling sed(1) script. 83 84 -ext Complain about f77(1) extensions. 85 86 -f Assume free-format input: accept text after column 72 87 and do not pad fixed-format lines shorter than 72 char- 88 acters with blanks. 89 90 -72 Treat text appearing after column 72 as an error. 91 92 -g Include original Fortran line numbers in #line lines. 93 94 -h Emulate Fortran 66's treatment of Hollerith: try to 95 align character strings on word (or, if the option is 96 `-hd', on double-word) boundaries. 97 98 -i2 Similar to -I2, but assume a modified libF77 and libI77 99 (compiled with -Df2c_i2), so INTEGER and LOGICAL vari- 100 ables may be assigned by INQUIRE and array lengths are 101 stored in short ints. 102 103 -i90 Do not recognize the Fortran 90 bit-manipulation 104 intrinsics btest, iand, ibclr, ibits, ibset, ieor, ior, 105 ishft, and ishftc. 106 107 -kr Use temporary values to enforce Fortran expression 108 evaluation where K&R (first edition) parenthesization 109 rules allow rearrangement. If the option is `-krd', 110 use double precision temporaries even for single- 111 precision operands. 112 113 Page 2 (printed 5/12/96) 114 115 F2C(1) UNIX System V F2C(1) 116 117 -P Write a file.P of ANSI (or C++) prototypes for defini- 118 tions in each input file.f or file.F. When reading 119 Fortran from standard input, write prototypes at the 120 beginning of standard output. Option -Ps implies -P 121 and gives exit status 4 if rerunning f2c may change 122 prototypes or declarations. 123 124 -p Supply preprocessor definitions to make common-block 125 members look like local variables. 126 127 -R Do not promote REAL functions and operations to DOUBLE 128 PRECISION. Option `-!R' confirms the default, which 129 imitates f77. 130 131 -r Cast values of REAL functions (including intrinsics) to 132 REAL. 133 134 -r8 Promote REAL to DOUBLE PRECISION, COMPLEX to DOUBLE 135 COMPLEX. 136 137 -s Preserve multidimensional subscripts. Suppressed by 138 option `-C' . 139 140 -Tdir 141 Put temporary files in directory dir. 142 143 -w8 Suppress warnings when COMMON or EQUIVALENCE forces 144 odd-word alignment of doubles. 145 146 -Wn Assume n characters/word (default 4) when initializing 147 numeric variables with character data. 148 149 -z Do not implicitly recognize DOUBLE COMPLEX. 150 151 -!bs Do not recognize backslash escapes (\", \', \0, \\, \b, 152 \f, \n, \r, \t, \v) in character strings. 153 154 -!c Inhibit C output, but produce -P output. 155 156 -!I Reject include statements. 157 158 -!i8 Disallow INTEGER*8. 159 160 -!it Don't infer types of untyped EXTERNAL procedures from 161 use as parameters to previously defined or prototyped 162 procedures. 163 164 -!P Do not attempt to infer ANSI or C++ prototypes from 165 usage. 166 167 The resulting C invokes the support routines of f77; object 168 code should be loaded by f77 or with ld(1) or cc(1) options 169 170 Page 3 (printed 5/12/96) 171 172 F2C(1) UNIX System V F2C(1) 173 174 -lF77 -lI77 -lm. Calling conventions are those of f77: see 175 the reference below. 176 177 FILES 178 file.[fF] input file 179 180 *.c output file 181 182 /usr/include/f2c.h 183 header file 184 185 /usr/lib/libF77.aintrinsic function library 186 187 /usr/lib/libI77.aFortran I/O library 188 189 /lib/libc.a C library, see section 3 190 191 SEE ALSO 192 S. I. Feldman and P. J. Weinberger, `A Portable Fortran 77 193 Compiler', UNIX Time Sharing System Programmer's Manual, 194 Tenth Edition, Volume 2, AT&T Bell Laboratories, 1990. 195 196 DIAGNOSTICS 197 The diagnostics produced by f2c are intended to be self- 198 explanatory. 199 200 BUGS 201 Floating-point constant expressions are simplified in the 202 floating-point arithmetic of the machine running f2c, so 203 they are typically accurate to at most 16 or 17 decimal 204 places. 205 Untypable EXTERNAL functions are declared int. 206 207 Page 4 (printed 5/12/96) 208 209