| 1 | . \" Definitions of F, L and LR for the benefit of systems |
| 2 | . \" whose -man lacks them... |
| 3 | .de F |
| 4 | .nh |
| 5 | .if n \%\&\\$1 |
| 6 | .if t \%\&\f(CW\\$1\fR |
| 7 | .hy 14 |
| 8 | .. |
| 9 | .de L |
| 10 | .nh |
| 11 | .if n \%`\\$1' |
| 12 | .if t \%\&\f(CW\\$1\fR |
| 13 | .hy 14 |
| 14 | .. |
| 15 | .de LR |
| 16 | .nh |
| 17 | .if n \%`\\$1'\\$2 |
| 18 | .if t \%\&\f(CW\\$1\fR\\$2 |
| 19 | .hy 14 |
| 20 | .. |
| 21 | .TH F2C 1 |
| 22 | .CT 1 prog_other |
| 23 | .SH NAME |
| 24 | f\^2c \(mi Convert Fortran 77 to C or C++ |
| 25 | .SH SYNOPSIS |
| 26 | .B f\^2c |
| 27 | [ |
| 28 | .I option ... |
| 29 | ] |
| 30 | .I file ... |
| 31 | .SH DESCRIPTION |
| 32 | .I F2c |
| 33 | converts Fortran 77 source code in |
| 34 | .I files |
| 35 | with names ending in |
| 36 | .L .f |
| 37 | or |
| 38 | .L .F |
| 39 | to C (or C++) source files in the |
| 40 | current directory, with |
| 41 | .L .c |
| 42 | substituted |
| 43 | for the final |
| 44 | .L .f |
| 45 | or |
| 46 | .LR .F . |
| 47 | If no Fortran files are named, |
| 48 | .I f\^2c |
| 49 | reads Fortran from standard input and |
| 50 | writes C on standard output. |
| 51 | .I File |
| 52 | names that end with |
| 53 | .L .p |
| 54 | or |
| 55 | .L .P |
| 56 | are taken to be prototype |
| 57 | files, as produced by option |
| 58 | .LR -P , |
| 59 | and are read first. |
| 60 | .PP |
| 61 | The following options have the same meaning as in |
| 62 | .IR f\^77 (1). |
| 63 | .TP |
| 64 | .B -C |
| 65 | Compile code to check that subscripts are within declared array bounds. |
| 66 | .TP |
| 67 | .B -I2 |
| 68 | Render INTEGER and LOGICAL as short, |
| 69 | INTEGER\(**4 as long int. Assume the default \fIlibF77\fR |
| 70 | and \fIlibI77\fR: allow only INTEGER\(**4 (and no LOGICAL) |
| 71 | variables in INQUIREs. Option |
| 72 | .L -I4 |
| 73 | confirms the default rendering of INTEGER as long int. |
| 74 | .TP |
| 75 | .B -onetrip |
| 76 | Compile DO loops that are performed at least once if reached. |
| 77 | (Fortran 77 DO loops are not performed at all if the upper limit is smaller than the lower limit.) |
| 78 | .TP |
| 79 | .B -U |
| 80 | Honor the case of variable and external names. Fortran keywords must be in |
| 81 | .I |
| 82 | lower |
| 83 | case. |
| 84 | .TP |
| 85 | .B -u |
| 86 | Make the default type of a variable `undefined' rather than using the default Fortran rules. |
| 87 | .TP |
| 88 | .B -w |
| 89 | Suppress all warning messages. |
| 90 | If the option is |
| 91 | .LR -w66 , |
| 92 | only Fortran 66 compatibility warnings are suppressed. |
| 93 | .PP |
| 94 | The following options are peculiar to |
| 95 | .IR f\^2c . |
| 96 | .TP |
| 97 | .B -A |
| 98 | Produce |
| 99 | .SM ANSI |
| 100 | C. |
| 101 | Default is old-style C. |
| 102 | .TP |
| 103 | .B -a |
| 104 | Make local variables automatic rather than static |
| 105 | unless they appear in a |
| 106 | .SM "DATA, EQUIVALENCE, NAMELIST," |
| 107 | or |
| 108 | .SM SAVE |
| 109 | statement. |
| 110 | .TP |
| 111 | .B -C++ |
| 112 | Output C++ code. |
| 113 | .TP |
| 114 | .B -c |
| 115 | Include original Fortran source as comments. |
| 116 | .TP |
| 117 | .B -E |
| 118 | Declare uninitialized |
| 119 | .SM COMMON |
| 120 | to be |
| 121 | .B Extern |
| 122 | (overridably defined in |
| 123 | .F f2c.h |
| 124 | as |
| 125 | .B extern). |
| 126 | .TP |
| 127 | .B -ec |
| 128 | Place uninitialized |
| 129 | .SM COMMON |
| 130 | blocks in separate files: |
| 131 | .B COMMON /ABC/ |
| 132 | appears in file |
| 133 | .BR abc_com.c . |
| 134 | Option |
| 135 | .LR -e1c |
| 136 | bundles the separate files |
| 137 | into the output file, with comments that give an unbundling |
| 138 | .IR sed (1) |
| 139 | script. |
| 140 | .TP |
| 141 | .B -ext |
| 142 | Complain about |
| 143 | .IR f\^77 (1) |
| 144 | extensions. |
| 145 | .TP |
| 146 | .B -f |
| 147 | Assume free-format input: accept text after column 72 and do not |
| 148 | pad fixed-format lines shorter than 72 characters with blanks. |
| 149 | .TP |
| 150 | .B -72 |
| 151 | Treat text appearing after column 72 as an error. |
| 152 | .TP |
| 153 | .B -g |
| 154 | Include original Fortran line numbers in \f(CW#line\fR lines. |
| 155 | .TP |
| 156 | .B -h |
| 157 | Emulate Fortran 66's treatment of Hollerith: try to align character strings on |
| 158 | word (or, if the option is |
| 159 | .LR -hd , |
| 160 | on double-word) boundaries. |
| 161 | .TP |
| 162 | .B -i2 |
| 163 | Similar to |
| 164 | .BR -I2 , |
| 165 | but assume a modified |
| 166 | .I libF77 |
| 167 | and |
| 168 | .I libI77 |
| 169 | (compiled with |
| 170 | .BR -Df\^2c_i2 ), |
| 171 | so |
| 172 | .SM INTEGER |
| 173 | and |
| 174 | .SM LOGICAL |
| 175 | variables may be assigned by |
| 176 | .SM INQUIRE |
| 177 | and array lengths are stored in short ints. |
| 178 | .TP |
| 179 | .B -kr |
| 180 | Use temporary values to enforce Fortran expression evaluation |
| 181 | where K&R (first edition) parenthesization rules allow rearrangement. |
| 182 | If the option is |
| 183 | .LR -krd , |
| 184 | use double precision temporaries even for single-precision operands. |
| 185 | .TP |
| 186 | .B -P |
| 187 | Write a |
| 188 | .IB file .P |
| 189 | of ANSI (or C++) prototypes |
| 190 | for definitions in each input |
| 191 | .IB file .f |
| 192 | or |
| 193 | .IB file .F . |
| 194 | When reading Fortran from standard input, write prototypes |
| 195 | at the beginning of standard output. Option |
| 196 | .B -Ps |
| 197 | implies |
| 198 | .B -P |
| 199 | and gives exit status 4 if rerunning |
| 200 | .I f\^2c |
| 201 | may change prototypes or declarations. |
| 202 | .TP |
| 203 | .B -p |
| 204 | Supply preprocessor definitions to make common-block members |
| 205 | look like local variables. |
| 206 | .TP |
| 207 | .B -R |
| 208 | Do not promote |
| 209 | .SM REAL |
| 210 | functions and operations to |
| 211 | .SM DOUBLE PRECISION. |
| 212 | Option |
| 213 | .L -!R |
| 214 | confirms the default, which imitates |
| 215 | .IR f\^77 . |
| 216 | .TP |
| 217 | .B -r |
| 218 | Cast values of REAL functions (including intrinsics) to REAL. |
| 219 | .TP |
| 220 | .B -r8 |
| 221 | Promote |
| 222 | .SM REAL |
| 223 | to |
| 224 | .SM DOUBLE PRECISION, COMPLEX |
| 225 | to |
| 226 | .SM DOUBLE COMPLEX. |
| 227 | .TP |
| 228 | .B -s |
| 229 | Preserve multidimensional subscripts. |
| 230 | .TP |
| 231 | .BI -T dir |
| 232 | Put temporary files in directory |
| 233 | .I dir. |
| 234 | .TP |
| 235 | .B -w8 |
| 236 | Suppress warnings when |
| 237 | .SM COMMON |
| 238 | or |
| 239 | .SM EQUIVALENCE |
| 240 | forces odd-word alignment of doubles. |
| 241 | .TP |
| 242 | .BI -W n |
| 243 | Assume |
| 244 | .I n |
| 245 | characters/word (default 4) |
| 246 | when initializing numeric variables with character data. |
| 247 | .TP |
| 248 | .B -z |
| 249 | Do not implicitly recognize |
| 250 | .SM DOUBLE COMPLEX. |
| 251 | .TP |
| 252 | .B -!bs |
| 253 | Do not recognize \fIb\fRack\fIs\fRlash escapes |
| 254 | (\e", \e', \e0, \e\e, \eb, \ef, \en, \er, \et, \ev) in character strings. |
| 255 | .TP |
| 256 | .B -!c |
| 257 | Inhibit C output, but produce |
| 258 | .B -P |
| 259 | output. |
| 260 | .TP |
| 261 | .B -!I |
| 262 | Reject |
| 263 | .B include |
| 264 | statements. |
| 265 | .TP |
| 266 | .B -!i8 |
| 267 | Disallow |
| 268 | .SM INTEGER*8. |
| 269 | .TP |
| 270 | .B -!it |
| 271 | Don't infer types of untyped |
| 272 | .SM EXTERNAL |
| 273 | procedures from use as parameters to previously defined or prototyped |
| 274 | procedures. |
| 275 | .TP |
| 276 | .B -!P |
| 277 | Do not attempt to infer |
| 278 | .SM ANSI |
| 279 | or C++ |
| 280 | prototypes from usage. |
| 281 | .PP |
| 282 | The resulting C invokes the support routines of |
| 283 | .IR f\^77 ; |
| 284 | object code should be loaded by |
| 285 | .I f\^77 |
| 286 | or with |
| 287 | .IR ld (1) |
| 288 | or |
| 289 | .IR cc (1) |
| 290 | options |
| 291 | .BR "-lF77 -lI77 -lm" . |
| 292 | Calling conventions |
| 293 | are those of |
| 294 | .IR f\&77 : |
| 295 | see the reference below. |
| 296 | .br |
| 297 | .SH FILES |
| 298 | .TP |
| 299 | .IB file .[fF] |
| 300 | input file |
| 301 | .TP |
| 302 | .B *.c |
| 303 | output file |
| 304 | .TP |
| 305 | .F /usr/include/f2c.h |
| 306 | header file |
| 307 | .TP |
| 308 | .F /usr/lib/libF77.a |
| 309 | intrinsic function library |
| 310 | .TP |
| 311 | .F /usr/lib/libI77.a |
| 312 | Fortran I/O library |
| 313 | .TP |
| 314 | .F /lib/libc.a |
| 315 | C library, see section 3 |
| 316 | .SH "SEE ALSO" |
| 317 | S. I. Feldman and |
| 318 | P. J. Weinberger, |
| 319 | `A Portable Fortran 77 Compiler', |
| 320 | \fIUNIX Time Sharing System Programmer's Manual\fR, |
| 321 | Tenth Edition, Volume 2, AT&T Bell Laboratories, 1990. |
| 322 | .SH DIAGNOSTICS |
| 323 | The diagnostics produced by |
| 324 | .I f\^2c |
| 325 | are intended to be |
| 326 | self-explanatory. |
| 327 | .SH BUGS |
| 328 | Floating-point constant expressions are simplified in |
| 329 | the floating-point arithmetic of the machine running |
| 330 | .IR f\^2c , |
| 331 | so they are typically accurate to at most 16 or 17 decimal places. |
| 332 | .br |
| 333 | Untypable |
| 334 | .SM EXTERNAL |
| 335 | functions are declared |
| 336 | .BR int . |