1F2C(1)                      General Commands Manual                     F2C(1)
2
3
4

NAME

6       f2c - Convert Fortran 77 to C or C++
7

SYNOPSIS

9       f2c [ option ...  ] file ...
10

DESCRIPTION

12       F2c  converts Fortran 77 source code in files with names ending in `.f'
13       or `.F' to C (or C++) source files in the current directory, with  `.c'
14       substituted for the final `.f' or `.F'.  If no Fortran files are named,
15       f2c reads Fortran from standard input and writes C on standard  output.
16       File  names 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 declared  array
22              bounds.
23
24       -I2    Render  INTEGER  and  LOGICAL  as  short, INTEGER∗4 as long int.
25              Assume the default libF77 and libI77:  allow only INTEGER∗4 (and
26              no  LOGICAL)  variables  in INQUIREs.  Option `-I4' confirms the
27              default rendering of INTEGER as long int.
28
29       -Idir  Look for a non-absolute include file first in the  directory  of
30              the  current  input  file,  then  in directories specified by -I
31              options (one directory per option).  Options -I2  and  -I4  have
32              precedence, so, e.g., a directory named 2 should be specified by
33              -I./2 .
34
35       -onetrip
36              Compile DO loops that are performed at least  once  if  reached.
37              (Fortran 77 DO loops are not performed at all if the upper limit
38              is smaller than the lower limit.)
39
40       -U     Honor the case of variable and external names.  Fortran keywords
41              must be in lower case.
42
43       -u     Make  the  default  type  of  a variable `undefined' rather than
44              using the default Fortran rules.
45
46       -w     Suppress all warning messages, or, if the option is `-w66', just
47              Fortran 66 compatibility warnings.
48
49       The following options are peculiar to f2c.
50
51       -A     Produce  ANSI  C (default, starting 20020621).  For old-style C,
52              use option -K.
53
54       -a     Make local variables automatic rather than  static  unless  they
55              appear in a DATA, EQUIVALENCE, NAMELIST, or SAVE statement.
56
57       -C++   Output C++ code.
58
59       -c     Include original Fortran source as comments.
60
61       -cd    Do  not  recognize cdabs, cdcos, cdexp, cdlog, cdsin, and cdsqrt
62              as synonyms for the double complex intrinsics zabs, zcos,  zexp,
63              zlog,  zsin, and zsqrt, respectively, nor dreal as a synonym for
64              dble.
65
66       -ddir  Write `.c' files in directory dir instead of the current  direc‐
67              tory.
68
69       -E     Declare  uninitialized  COMMON to be Extern (overridably defined
70              in f2c.h as extern).
71
72       -ec    Place uninitialized COMMON  blocks  in  separate  files:  COMMON
73              /ABC/ appears in file abc_com.c.  Option `-e1c' bundles the sep‐
74              arate files into the output file, with  comments  that  give  an
75              unbundling sed(1) script.
76
77       -ext   Complain about f77(1) extensions.
78
79       -f     Assume free-format input: accept text after column 72 and do not
80              pad fixed-format lines shorter than 72 characters with blanks.
81
82       -72    Treat text appearing after column 72 as an error.
83
84       -g     Include original Fortran line numbers in #line lines.
85
86       -h     Emulate Fortran 66's treatment of Hollerith: try to align  char‐
87              acter  strings  on  word (or, if the option is `-hd', on double-
88              word) boundaries.
89
90       -i2    Similar to -I2, but assume a modified libF77  and  libI77  (com‐
91              piled  with  -Df2c_i2),  so INTEGER and LOGICAL variables may be
92              assigned by INQUIRE and array lengths are stored in short ints.
93
94       -i90   Do not recognize  the  Fortran  90  bit-manipulation  intrinsics
95              btest, iand, ibclr, ibits, ibset, ieor, ior, ishft, and ishftc.
96
97       -kr    Use  temporary  values  to enforce Fortran expression evaluation
98              where K&R  (first  edition)  parenthesization  rules  allow  re‐
99              arrangement.  If the option is `-krd', use double precision tem‐
100              poraries even for single-precision operands.
101
102       -P     Write a file.P of ANSI (or C++) prototypes  for  definitions  in
103              each input file.f or file.F.  When reading Fortran from standard
104              input, write prototypes at the  beginning  of  standard  output.
105              Option  -Ps  implies -P and gives exit status 4 if rerunning f2c
106              may change prototypes or declarations.
107
108       -p     Supply preprocessor definitions  to  make  common-block  members
109              look like local variables.
110
111       -R     Do  not  promote  REAL functions and operations to DOUBLE PRECI‐
112              SION.  Option `-!R' confirms the default, which imitates f77.
113
114       -r     Cast REAL arguments of intrinsic functions and  values  of  REAL
115              functions (including intrinsics) to REAL.
116
117       -r8    Promote REAL to DOUBLE PRECISION, COMPLEX to DOUBLE COMPLEX.
118
119       -s     Preserve multidimensional subscripts.  Suppressed by option `-C'
120              .
121
122       -Tdir  Put temporary files in directory dir.
123
124       -trapuv
125              Dynamically initialize local variables, except  those  appearing
126              in  SAVE or DATA statements, with values that may help find ref‐
127              erences to uninitialized  variables.   For  example,  with  IEEE
128              arithmetic, initialize local floating-point variables to signal‐
129              ing NaNs.
130
131       -w8    Suppress warnings when COMMON  or  EQUIVALENCE  forces  odd-word
132              alignment of doubles.
133
134       -Wn    Assume  n  characters/word (default 4) when initializing numeric
135              variables with character data.
136
137       -z     Do not implicitly recognize DOUBLE COMPLEX.
138
139       -!bs   Do not recognize backslash escapes (\", \', \0, \\, \b, \f,  \n,
140              \r, \t, \v) in character strings.
141
142       -!c    Inhibit C output, but produce -P output.
143
144       -!I    Reject include statements.
145
146       -!i8   Disallow  INTEGER*8  ,  or, if the option is `-!i8const', permit
147              INTEGER*8 but do not promote integer constants to INTEGER*8 when
148              they involve more than 32 bits.
149
150       -!it   Don't  infer  types  of  untyped EXTERNAL procedures from use as
151              parameters to previously defined or prototyped procedures.
152
153       -!P    Do not attempt to infer ANSI or C++ prototypes from usage.
154
155       The resulting C invokes the support routines of f77; object code should
156       be loaded by f77 or with ld(1) or cc(1) options -lF77 -lI77 -lm.  Call‐
157       ing conventions are those of f77: see the reference below.
158

FILES

160       file.[fF]
161              input file
162
163       *.c    output file
164
165       /usr/include/f2c.h
166              header file
167
168       /usr/lib/libF77.a
169              intrinsic function library
170
171       /usr/lib/libI77.a
172              Fortran I/O library
173
174       /lib/libc.a
175              C library, see section 3
176

SEE ALSO

178       S. I. Feldman and P. J. Weinberger, `A Portable Fortran  77  Compiler',
179       UNIX  Time Sharing System Programmer's Manual, Tenth Edition, Volume 2,
180       AT&T Bell Laboratories, 1990.
181

DIAGNOSTICS

183       The diagnostics produced by f2c are intended to be self-explanatory.
184

BUGS

186       Floating-point constant expressions are  simplified  in  the  floating-
187       point  arithmetic  of  the  machine  running f2c, so they are typically
188       accurate to at most 16 or 17 decimal places.
189       Untypable EXTERNAL functions are declared int.
190       There is no notation for INTEGER*8 constants.
191       Some intrinsic functions do not yet work with INTEGER*8 .
192
193
194
195                                                                        F2C(1)
Impressum