-
Notifications
You must be signed in to change notification settings - Fork 0
/
f2c.1t
399 lines (399 loc) · 7.66 KB
/
f2c.1t
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
. \" Definitions of F, L and LR for the benefit of systems
. \" whose -man lacks them...
.de F
.nh
.if n \%\&\\$1
.if t \%\&\f(CW\\$1\fR
.hy 14
..
.de L
.nh
.if n \%`\\$1'
.if t \%\&\f(CW\\$1\fR
.hy 14
..
.de LR
.nh
.if n \%`\\$1'\\$2
.if t \%\&\f(CW\\$1\fR\\$2
.hy 14
..
.TH F2C 1
.CT 1 prog_other
.SH NAME
f2c \- Convert Fortran 77 to C or C++
. \" f\^2c changed to f2c in the previous line for the benefit of
. \" people on systems (e.g. Sun systems) whose makewhatis cannot
. \" cope with troff formatting commands.
.SH SYNOPSIS
.B f\^2c
[
.I option ...
]
.I file ...
.SH DESCRIPTION
.I F2c
converts Fortran 77 source code in
.I files
with names ending in
.L .f
or
.L .F
to C (or C++) source files in the
current directory, with
.L .c
substituted
for the final
.L .f
or
.LR .F .
If no Fortran files are named,
.I f\^2c
reads Fortran from standard input and
writes C on standard output.
.I File
names that end with
.L .p
or
.L .P
are taken to be prototype
files, as produced by option
.LR -P ,
and are read first.
.PP
The following options have the same meaning as in
.IR f\^77 (1).
.TP
.B -C
Compile code to check that subscripts are within declared array bounds.
.TP
.B -I2
Render INTEGER and LOGICAL as short,
INTEGER\(**4 as long int. Assume the default \fIlibF77\fR
and \fIlibI77\fR: allow only INTEGER\(**4 (and no LOGICAL)
variables in INQUIREs. Option
.L -I4
confirms the default rendering of INTEGER as long int.
.TP
.B -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.
.TP
.BI -I dir
Look for a non-absolute include file first in the directory of the
current input file, then in directories specified by \f(CW-I\fP
options (one directory per option). Options
\f(CW-I2\fP, \f(CW-I4\fP, and \f(CW-I8\fP
have precedence, so, e.g., a directory named \f(CW2\fP
should be specified by \f(CW-I./2\fP .
.TP
.B -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.)
.TP
.B -U
Honor the case of variable and external names. Fortran keywords must be in
.I
lower
case.
.TP
.B -u
Make the default type of a variable `undefined' rather than using the default Fortran rules.
.TP
.B -w
Suppress all warning messages, or, if the option is
.LR -w66 ,
just Fortran 66 compatibility warnings.
.PP
The following options are peculiar to
.IR f\^2c .
.TP
.B -A
Produce
.SM ANSI
C (default, starting 20020621).
For old-style C, use option \f(CW-K\fP.
.TP
.B -a
Make local variables automatic rather than static
unless they appear in a
.SM "DATA, EQUIVALENCE, NAMELIST,"
or
.SM SAVE
statement.
.TP
.B -C++
Output C++ code.
.TP
.B -c
Include original Fortran source as comments.
.TP
.B -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.
.TP
.B -cf
Do not report the current \f(CW.f\fP file except in error messages.
.TP
.BI -d dir
Write
.L .c
files in directory
.I dir
instead of the current directory.
.TP
.B -E
Declare uninitialized
.SM COMMON
to be
.B Extern
(overridably defined in
.F f2c.h
as
.B extern).
.TP
.B -ec
Place uninitialized
.SM COMMON
blocks in separate files:
.B COMMON /ABC/
appears in file
.BR abc_com.c .
Option
.LR -e1c
bundles the separate files
into the output file, with comments that give an unbundling
.IR sed (1)
script.
.TP
.B -ext
Complain about
.IR f\^77 (1)
extensions.
.TP
.B -f
Assume free-format input: accept text after column 72 and do not
pad fixed-format lines shorter than 72 characters with blanks.
.TP
.B -72
Treat text appearing after column 72 as an error.
.TP
.B -g
Include original Fortran line numbers in \f(CW#line\fR lines.
.TP
.B -h
Emulate Fortran 66's treatment of Hollerith: try to align character strings on
word (or, if the option is
.LR -hd ,
on double-word) boundaries.
.TP
.B -i2
Similar to
.BR -I2 ,
but assume a modified
.I libF77
and
.I libI77
(compiled with
.BR -Df\^2c_i2 ),
so
.SM INTEGER
and
.SM LOGICAL
variables may be assigned by
.SM INQUIRE
and array lengths are stored in short ints.
.TP
.B -i90
Do not recognize the Fortran 90 bit-manipulation intrinsics
btest, iand, ibclr, ibits, ibset, ieor, ior, ishft, and ishftc.
.TP
.B -kr
Use temporary values to enforce Fortran expression evaluation
where K&R (first edition) parenthesization rules allow rearrangement.
If the option is
.LR -krd ,
use double precision temporaries even for single-precision operands.
.TP
.B -P
Write a
.IB file .P
of ANSI (or C++) prototypes
for definitions in each input
.IB file .f
or
.IB file .F .
When reading Fortran from standard input, write prototypes
at the beginning of standard output. Option
.B -Ps
implies
.B -P
and gives exit status 4 if rerunning
.I f\^2c
may change prototypes or declarations.
.TP
.B -p
Supply preprocessor definitions to make common-block members
look like local variables.
.TP
.B -R
Do not promote
.SM REAL
functions and operations to
.SM DOUBLE PRECISION.
Option
.L -!R
confirms the default, which imitates
.IR f\^77 .
.TP
.B -r
Cast REAL arguments of intrinsic functions and values of REAL
functions (including intrinsics) to REAL.
.TP
.B -r8
Promote
.SM REAL
to
.SM DOUBLE PRECISION, COMPLEX
to
.SM DOUBLE COMPLEX.
.TP
.B -s
Preserve multidimensional subscripts. Suppressed by option
.L -C
\&.
.TP
.BI -T dir
Put temporary files in directory
.I dir.
.TP
.B -trapuv
Dynamically initialize local variables, except those appearing in
.SM SAVE
or
.SM 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.
.TP
.B -w8
Suppress warnings when
.SM COMMON
or
.SM EQUIVALENCE
forces odd-word alignment of doubles.
.TP
.BI -W n
Assume
.I n
characters/word (default 4)
when initializing numeric variables with character data.
.TP
.B -z
Do not implicitly recognize
.SM DOUBLE COMPLEX.
.TP
.B -!bs
Do not recognize \fIb\fRack\fIs\fRlash escapes
(\e", \e', \e0, \e\e, \eb, \ef, \en, \er, \et, \ev) in character strings.
.TP
.B -!c
Inhibit C output, but produce
.B -P
output.
.TP
.B -!I
Reject
.B include
statements.
.TP
.B -!i8
Disallow
.SM INTEGER*8 ,
or, if the option is
.LR -!i8const ,
permit
.SM INTEGER*8
but do not promote integer
constants to
.SM INTEGER*8
when they involve more than 32 bits.
.TP
.B -!it
Don't infer types of untyped
.SM EXTERNAL
procedures from use as parameters to previously defined or prototyped
procedures.
.TP
.B -!P
Do not attempt to infer
.SM ANSI
or C++
prototypes from usage.
.PP
The resulting C invokes the support routines of
.IR f\^77 ;
object code should be loaded by
.I f\^77
or with
.IR ld (1)
or
.IR cc (1)
options
.BR "-lF77 -lI77 -lm" .
Calling conventions
are those of
.IR f\&77 :
see the reference below.
.br
.SH FILES
.TP
.nr )I 1.75i
.IB file .[fF]
input file
.TP
.B *.c
output file
.TP
.F /usr/include/f2c.h
header file
.TP
.F /usr/lib/libF77.a
intrinsic function library
.TP
.F /usr/lib/libI77.a
Fortran I/O library
.TP
.F /lib/libc.a
C library, see section 3
.SH "SEE ALSO"
S. I. Feldman and
P. J. Weinberger,
`A Portable Fortran 77 Compiler',
\fIUNIX Time Sharing System Programmer's Manual\fR,
Tenth Edition, Volume 2, AT&T Bell Laboratories, 1990.
.SH DIAGNOSTICS
The diagnostics produced by
.I f\^2c
are intended to be
self-explanatory.
.SH BUGS
Floating-point constant expressions are simplified in
the floating-point arithmetic of the machine running
.IR f\^2c ,
so they are typically accurate to at most 16 or 17 decimal places.
.br
Untypable
.SM EXTERNAL
functions are declared
.BR int .
.br
There is no notation for
.SM INTEGER*8
constants.
.br
Some intrinsic functions do not yet work with
.SM INTEGER*8 .