mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-23 11:18:54 +00:00
302 lines
7.7 KiB
Groff
302 lines
7.7 KiB
Groff
.\" mdoc translation of the f2c.1 manpage (deprecated -man format) supplied
|
|
.\" with f2c. The original manpage did not have a copyright statement, but
|
|
.\" the file /usr/src/bin/f2c/Notice states:
|
|
.\"
|
|
.\"/****************************************************************
|
|
.\"Copyright 1990 - 1997 by AT&T Bell Laboratories and Bellcore.
|
|
.\"
|
|
.\"Permission to use, copy, modify, and distribute this software
|
|
.\"and its documentation for any purpose and without fee is hereby
|
|
.\"granted, provided that the above copyright notice appear in all
|
|
.\"copies and that both that the copyright notice and this
|
|
.\"permission notice and warranty disclaimer appear in supporting
|
|
.\"documentation, and that the names of AT&T Bell Laboratories or
|
|
.\"Bellcore or any of their entities not be used in advertising or
|
|
.\"publicity pertaining to distribution of the software without
|
|
.\"specific, written prior permission.
|
|
.\"
|
|
.\"AT&T and Bellcore disclaim all warranties with regard to this
|
|
.\"software, including all implied warranties of merchantability
|
|
.\"and fitness. In no event shall AT&T or Bellcore be liable for
|
|
.\"any special, indirect or consequential damages or any damages
|
|
.\"whatsoever resulting from loss of use, data or profits, whether
|
|
.\"in an action of contract, negligence or other tortious action,
|
|
.\"arising out of or in connection with the use or performance of
|
|
.\"this software.
|
|
.\"****************************************************************/
|
|
.\"
|
|
.Dd April 19, 1996
|
|
.Os "AT&T Bell Lab and Bellcore"
|
|
.Dt F2C 1
|
|
.Sh NAME
|
|
.Nm f2c
|
|
.Nd Convert Fortran 77 to C or C++
|
|
.Sh SYNOPSIS
|
|
.Nm f2c
|
|
.Op Fl AaCcEfgpRrsUuw
|
|
.Op Fl C++
|
|
.Op Fl cd
|
|
.Op Fl d Ar dir
|
|
.Op Fl ec
|
|
.Op Fl e1c
|
|
.Op Fl ext
|
|
.Op Fl h Ns Op Cm d
|
|
.Op Fl \&I2
|
|
.Op Fl \&i2
|
|
.Op Fl i90
|
|
.Op Fl kr Ns Op Cm d
|
|
.Op Fl o Ar name
|
|
.Op Fl onetrip
|
|
.Op Fl P Ns Op Cm s
|
|
.Op Fl r8
|
|
.Op Fl 72
|
|
.Op Fl T Ar dir
|
|
.Op Fl w8
|
|
.Op Fl W Ns Ar n
|
|
.Op Fl z
|
|
.Op Fl !bs
|
|
.Op Fl !c
|
|
.Op Fl !I
|
|
.Op Fl !i8
|
|
.Op Fl !it
|
|
.Op Fl !P
|
|
.Ar file ...
|
|
.Sh DESCRIPTION
|
|
.Nm F2c
|
|
converts Fortran 77 source code in
|
|
.Ar files
|
|
with names ending in
|
|
.So \&.f Sc
|
|
or
|
|
.So \&.F Sc
|
|
to C (or C++) source files in the current directory, with
|
|
.So \&.c Sc
|
|
substituted for the final
|
|
.So \&.f Sc
|
|
or
|
|
.So \&.F Sc .
|
|
If no Fortran files are named,
|
|
.Nm f2c
|
|
reads Fortran from standard input and writes C on standard output.
|
|
.Ar File
|
|
names that end with
|
|
.So \&.p Sc
|
|
or
|
|
.So \&.P Sc
|
|
are taken to be prototype files, as produced by option
|
|
.Fl P ,
|
|
and are read first.
|
|
.Sh OPTIONS
|
|
.Bl -tag -width flag
|
|
.It Fl A
|
|
Produce ANSI C. Default is old-style C.
|
|
.It Fl a
|
|
Make local variables automatic rather than static unless they appear in a
|
|
DATA , EQUIVALENCE , NAMELIST , or SAVE statement.
|
|
.It Fl C
|
|
Compile code to check that subscripts are within declared array bounds.
|
|
.It Fl C++
|
|
Output C++ code.
|
|
.It Fl c
|
|
Include original Fortran source as comments.
|
|
.It Fl 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.
|
|
.It Fl d Ar dir
|
|
Write `.c' files in directory
|
|
.Ar dir
|
|
instead of the current directory
|
|
.It Fl E
|
|
Declare uninitialized COMMON to be Extern (overridably defined in
|
|
.Pa f2c.h
|
|
as
|
|
.Em extern
|
|
).
|
|
.It Fl ec
|
|
Place uninitialized COMMON blocks in separate files:
|
|
COMMON ABC appears in file abc_com.c .
|
|
Option
|
|
.Fl e1c
|
|
bundles the separate files
|
|
into the output file, with comments that give an unbundling
|
|
.Xr sed 1
|
|
script.
|
|
.It Fl e1c
|
|
See
|
|
.Fl ec .
|
|
.It Fl ext
|
|
Complain about Fortran 77 extensions.
|
|
.It Fl f
|
|
Assume free-format input: accept text after column 72 and do not
|
|
pad fixed-format lines shorter than 72 characters with blanks.
|
|
.It Fl 72
|
|
Treat text appearing after column 72 as an error.
|
|
.It Fl g
|
|
Include original Fortran line numbers in
|
|
.Sy #line
|
|
lines.
|
|
.It Fl h Ns Op Cm d
|
|
Emulate Fortran 66's treatment of Hollerith: try to align character strings on
|
|
word (or, if the option is
|
|
.Fl hd ,
|
|
on double-word) boundaries.
|
|
.It Fl \&I2
|
|
Render INTEGER and LOGICAL as short, INTEGER*4 as long int. Assume the
|
|
default
|
|
.Em libF77
|
|
and
|
|
.Em libI77
|
|
allow only INTEGER*4 (and no LOGICAL) variables in INQUIREs. Option
|
|
.Fl \&I4
|
|
confirms the default rendering of INTEGER as long int.
|
|
.It Fl \&i2
|
|
Similar to
|
|
.Fl \&I2 ,
|
|
but assume a modified
|
|
.Em libF77
|
|
and
|
|
.Em libI77
|
|
(compiled with
|
|
.Fl Df2c_i2 ),
|
|
so INTEGER and LOGICAL variables may be assigned by INQUIRE and array lengths
|
|
are stored in short ints
|
|
.It Fl i90
|
|
Do not recognize the Fortran 90 bit-manipulation intrinsics btest,
|
|
iand, ibclr, ibits, ibset, ieor, ior, ishft, and ishftc.
|
|
.It Fl kr Ns Op Cm d
|
|
Use temporary values to enforce Fortran expression evaluation
|
|
where K&R (first edition) parenthesization rules allow rearrangement.
|
|
If the option is
|
|
.Fl krd ,
|
|
use double precision temporaries even for single-precision operands.
|
|
.It Fl o Ar name
|
|
The C source code is written into file
|
|
.Ar name .
|
|
.It Fl 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.)
|
|
.It Fl P Ns Op Cm s
|
|
Write a
|
|
.Ar file Ns \&.P
|
|
of ANSI (or C++) prototypes for definitions in each input
|
|
.Ar file Ns \&.f
|
|
or
|
|
.Ar file Ns \&.F .
|
|
When reading Fortran from standard input, write prototypes at the beginning of
|
|
standard output. Option
|
|
.Fl Ps
|
|
implies
|
|
.Fl P
|
|
and gives exit status 4 if rerunning
|
|
.Nm f2c
|
|
may change prototypes or declarations.
|
|
.It Fl p
|
|
Supply preprocessor definitions to make common-block members look like local
|
|
variables.
|
|
.It Fl R
|
|
Do not promote REAL functions and operations to DOUBLE PRECISION. Option
|
|
.Fl !R
|
|
confirms the default, which imitates Fortran 77.
|
|
.It Fl r
|
|
Cast values of REAL functions (including intrinsics) to REAL.
|
|
.It Fl r8
|
|
Promote REAL to DOUBLE PRECISION, COMPLEX to DOUBLE COMPLEX.
|
|
.It Fl s
|
|
Preserve multidimensional subscripts.
|
|
.It Fl T Ar dir
|
|
Put temporary files in directory
|
|
.Ar dir .
|
|
.It Fl U
|
|
Honor the case of variable and external names. Fortran keywords must be in
|
|
.Em lower
|
|
case.
|
|
.It Fl u
|
|
Make the default type of a variable
|
|
.So undefined Sc
|
|
rather than using the default Fortran rules.
|
|
.It Fl w
|
|
Suppress all warning messages. If the option is
|
|
.Fl w66 ,
|
|
only Fortran 66 compatibility warnings are suppressed.
|
|
.It Fl w8
|
|
Suppress warnings when COMMON or EQUIVALENCE forces odd-word alignment of
|
|
doubles.
|
|
.It Fl W Ns Ar n
|
|
Assume
|
|
.Ar n
|
|
characters/word (default 4) when initializing numeric variables with character
|
|
data.
|
|
.It Fl z
|
|
Do not implicitly recognize DOUBLE COMPLEX.
|
|
.It Fl !bs
|
|
Do not recognize
|
|
.Em backslash
|
|
escapes
|
|
(\e", \e', \e0, \e\e, \eb, \ef, \en, \er, \et, \ev) in character strings.
|
|
.It Fl !c
|
|
Inhibit C output, but produce
|
|
.Fl P
|
|
output.
|
|
.It Fl !I
|
|
Reject
|
|
.Sy include
|
|
statements.
|
|
.It Fl !i8
|
|
Disallow INTEGER*8.
|
|
.It Fl !it
|
|
Don't infer types of untyped EXTERNAL procedures from use as parameters to
|
|
previously defined or prototyped procedures.
|
|
.It Fl !P
|
|
Do not attempt to infer ANSI or C++ prototypes from usage.
|
|
.El
|
|
.Pp
|
|
Object code should be loaded by with
|
|
.Xr ld 1
|
|
or
|
|
.Xr cc 1
|
|
and the following libraries need to specified:
|
|
.Fl lf2c lm .
|
|
.Sh FILES
|
|
.Ar file Ns \&.[fF]
|
|
input file
|
|
|
|
.Ar file Ns \&.c
|
|
output file
|
|
|
|
.Pa /usr/include/f2c.h
|
|
header file
|
|
|
|
.Pa /usr/lib/libf2c.a
|
|
intrinsic function library and Fortran 77 I/O library
|
|
|
|
.Sh "SEE ALSO"
|
|
.Rs
|
|
.%A S. I. Feldman
|
|
.%A P. J. Weinberger
|
|
.%T A Portable Fortran 77 Compiler
|
|
.%B UNIX Time Sharing System Programmer's Manual
|
|
.%V Volume 2
|
|
.%D 1990
|
|
.%O AT&T Bell Laboratories
|
|
.%N Tenth Edition
|
|
.Re
|
|
.Sh DIAGNOSTICS
|
|
The diagnostics produced by
|
|
.Nm f2c
|
|
are intended to be
|
|
self-explanatory.
|
|
.Sh BUGS
|
|
Floating-point constant expressions are simplified in
|
|
the floating-point arithmetic of the machine running
|
|
.Nm f2c
|
|
so they are typically accurate to at most 16 or 17 decimal places.
|
|
.Pp
|
|
Untypable EXTERNAL functions are declared int.
|
|
.Pp
|
|
There are several undocumented valid options for
|
|
.Nm f2c .
|
|
These options are discussed at the top of
|
|
.Pa /usr/src/usr.bin/f2c/main.c .
|