Pristine Ack-5.5
[Ack-5.5.git] / lang / fortran / comp / f2c.6
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 6
22 .CT 1 prog_other
23 .SH NAME
24 f\^2c \(mi Convert Fortran 77 to C or C++
25 .SH SYNOPSIS
26 .B ~em/lib.bin/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 -g
147 Include original Fortran line numbers as comments.
148 .TP
149 .B -h
150 Try to align character strings on word (or, if the option is
151 .LR -hd ,
152 on double-word) boundaries.
153 .TP
154 .B -i2
155 Similar to
156 .BR -I2 ,
157 but assume a modified
158 .I libF77
159 and
160 .I libI77
161 (compiled with
162 .BR -Df\^2c_i2 ),
163 so
164 .SM INTEGER
165 and
166 .SM LOGICAL
167 variables may be assigned by
168 .SM INQUIRE
169 and array lengths are stored in short ints.
170 .TP
171 .B -kr
172 Use temporary values to enforce Fortran expression evaluation
173 where K&R (first edition) parenthesization rules allow rearrangement.
174 If the option is
175 .LR -krd ,
176 use double precision temporaries even for single-precision operands.
177 .TP
178 .B -P
179 Write a
180 .IB file .P
181 of ANSI (or C++) prototypes
182 for procedures defined in each input
183 .IB file .f
184 or
185 .IB file .F .
186 When reading Fortran from standard input, write prototypes
187 at the beginning of standard output.
188 Implies
189 .B -A
190 unless option
191 .L -C++
192 is present.  Option
193 .B -Ps
194 implies
195 .B -P ,
196 and gives exit status 4 if rerunning
197 .I f\^2c
198 may change prototypes or declarations.
199 .TP
200 .B -p
201 Supply preprocessor definitions to make common-block members
202 look like local variables.
203 .TP
204 .B -R
205 Do not promote
206 .SM REAL
207 functions and operations to
208 .SM DOUBLE PRECISION.
209 Option
210 .L -!R
211 confirms the default, which imitates
212 .IR f\^77 .
213 .TP
214 .B -r
215 Cast values of REAL functions (including intrinsics) to REAL.
216 .TP
217 .B -r8
218 Promote
219 .SM REAL
220 to
221 .SM DOUBLE PRECISION, COMPLEX
222 to
223 .SM DOUBLE COMPLEX.
224 .TP
225 .BI -T dir
226 Put temporary files in directory
227 .I dir.
228 .TP
229 .B -w8
230 Suppress warnings when
231 .SM COMMON
232 or
233 .SM EQUIVALENCE
234 forces odd-word alignment of doubles.
235 .TP
236 .BI -W n
237 Assume
238 .I n
239 characters/word (default 4)
240 when initializing numeric variables with character data.
241 .TP
242 .B -z
243 Do not implicitly recognize
244 .SM DOUBLE COMPLEX.
245 .TP
246 .B -!bs
247 Do not recognize \fIb\fRack\fIs\fRlash escapes
248 (\e", \e', \e0, \e\e, \eb, \ef, \en, \er, \et, \ev) in character strings.
249 .TP
250 .B -!c
251 Inhibit C output, but produce
252 .B -P
253 output.
254 .TP
255 .B -!I
256 Reject
257 .B include
258 statements.
259 .TP
260 .B -!it
261 Don't infer types of untyped
262 .SM EXTERNAL
263 procedures from use as parameters to previously defined or prototyped
264 procedures.
265 .TP
266 .B -!P
267 Do not attempt to infer
268 .SM ANSI
269 or C++
270 prototypes from usage.
271 .PP
272 The resulting C invokes the support routines of
273 .IR f\^77 ;
274 object code should be loaded by
275 .I f\^77
276 or with
277 .IR ld (1)
278 or
279 .IR cc (1)
280 options
281 .BR "-lF77 -lI77 -lm" .
282 Calling conventions
283 are those of
284 .IR f\&77 :
285 see the reference below.
286 .br
287 .SH FILES
288 .TP
289 .IB file .[fF]
290 input file
291 .TP
292 .B *.c
293 output file
294 .TP
295 .F ~em/include/fortran/f2c.h
296 header file
297 .SH "SEE ALSO"
298 S. I. Feldman and
299 P. J. Weinberger,
300 `A Portable Fortran 77 Compiler',
301 \fIUNIX Time Sharing System Programmer's Manual\fR,
302 Tenth Edition, Volume 2, AT&T Bell Laboratories, 1990.
303 .SH DIAGNOSTICS
304 The diagnostics produced by
305 .I f\^2c
306 are intended to be
307 self-explanatory.
308 .SH BUGS
309 Floating-point constant expressions are simplified in
310 the floating-point arithmetic of the machine running
311 .IR f\^2c ,
312 so they are typically accurate to at most 16 or 17 decimal places.
313 .br
314 Untypable
315 .SM EXTERNAL
316 functions are declared
317 .BR int .