-
Notifications
You must be signed in to change notification settings - Fork 0
/
f2c.1
227 lines (159 loc) · 7.61 KB
/
f2c.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
F2C(1) UNIX System V F2C(1)
NAME
f2c - Convert Fortran 77 to C or C++
SYNOPSIS
f2c [ option ... ] file ...
DESCRIPTION
F2c converts Fortran 77 source code in files with names end-
ing in `.f' or `.F' to C (or C++) source files in the cur-
rent 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).
-C Compile code to check that subscripts are within
declared array bounds.
-I2 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 `-I4' confirms the default rendering of INTEGER
as long int.
-I8 Assume 8-byte integer and logical, 4-byte REAL, 8-byte
double precison and complex, and 16-byte double complex
variables. Appropriate changes to f2c.h may be needed.
-Idir
Look for a non-absolute include file first in the
directory of the current input file, then in directo-
ries specified by -I options (one directory per
option). Options -I2, -I4 and -I8 have precedence, so,
e.g., a directory named 2 should 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 variable `undefined' rather
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.
-A Produce ANSI C (default, starting 20020621). For old-
style C, use option -K.
Page 1 (printed 1/23/24)
F2C(1) UNIX System V F2C(1)
-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 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.
-cf Do not report the current .f file except in error messages.
-ddir
Write `.c' files in directory dir instead of the cur-
rent directory.
-E Declare uninitialized COMMON to be Extern (overridably
defined in f2c.h as extern).
-ec Place uninitialized COMMON blocks 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.
-ext Complain about f77(1) extensions.
-f Assume free-format input: accept text after column 72
and do not pad fixed-format lines shorter than 72 char-
acters with blanks.
-72 Treat text appearing after column 72 as an error.
-g Include original Fortran line numbers in #line lines.
-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 modified libF77 and libI77
(compiled with -Df2c_i2), so INTEGER and LOGICAL vari-
ables may be assigned by INQUIRE and array lengths are
stored in short ints.
-i90 Do not recognize the Fortran 90 bit-manipulation
intrinsics btest, iand, ibclr, ibits, ibset, ieor, ior,
ishft, and ishftc.
-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-
Page 2 (printed 1/23/24)
F2C(1) UNIX System V F2C(1)
precision operands.
-P Write a file.P of ANSI (or C++) prototypes for defini-
tions 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.
-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 `-!R' confirms the default, which
imitates f77.
-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 -P output.
-!I Reject include statements.
-!i8 Disallow INTEGER*8 , or, if the option is `-!i8const',
permit INTEGER*8 but do not promote integer constants
Page 3 (printed 1/23/24)
F2C(1) UNIX System V F2C(1)
to INTEGER*8 when 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.aintrinsic function library
/usr/lib/libI77.aFortran 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*8 constants.
Some intrinsic functions do not yet work with INTEGER*8 .
Page 4 (printed 1/23/24)