1996-05-15 20:27:10 +00:00
|
|
|
.\" 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, 1991, 1992, 1993 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 ec
|
|
|
|
.Op Fl e1c
|
|
|
|
.Op Fl ext
|
|
|
|
.Op Fl h Ns Op Cm d
|
|
|
|
.Op Fl \&I2
|
|
|
|
.Op Fl \&i2
|
|
|
|
.Op Fl kr Ns Op Cm d
|
1996-10-22 05:36:57 +00:00
|
|
|
.Op Fl o Ar name
|
1996-05-15 20:27:10 +00:00
|
|
|
.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
|
1994-01-05 03:24:01 +00:00
|
|
|
converts Fortran 77 source code in
|
1996-05-15 20:27:10 +00:00
|
|
|
.Ar files
|
1994-01-05 03:24:01 +00:00
|
|
|
with names ending in
|
1996-05-15 20:27:10 +00:00
|
|
|
.So \&.f Sc
|
1994-01-05 03:24:01 +00:00
|
|
|
or
|
1996-05-15 20:27:10 +00:00
|
|
|
.So \&.F Sc
|
|
|
|
to C (or C++) source files in the current directory, with
|
|
|
|
.So \&.c Sc
|
|
|
|
substituted for the final
|
|
|
|
.So \&.f Sc
|
1994-01-05 03:24:01 +00:00
|
|
|
or
|
1996-05-15 20:27:10 +00:00
|
|
|
.So \&.F Sc .
|
1994-01-05 03:24:01 +00:00
|
|
|
If no Fortran files are named,
|
1996-05-15 20:27:10 +00:00
|
|
|
.Nm f2c
|
|
|
|
reads Fortran from standard input and writes C on standard output.
|
|
|
|
.Ar File
|
1994-01-05 03:24:01 +00:00
|
|
|
names that end with
|
1996-05-15 20:27:10 +00:00
|
|
|
.So \&.p Sc
|
1994-01-05 03:24:01 +00:00
|
|
|
or
|
1996-05-15 20:27:10 +00:00
|
|
|
.So \&.P Sc
|
|
|
|
are taken to be prototype files, as produced by option
|
|
|
|
.Fl P ,
|
1994-01-05 03:24:01 +00:00
|
|
|
and are read first.
|
1996-05-15 20:27:10 +00:00
|
|
|
.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
|
1994-01-05 03:24:01 +00:00
|
|
|
Compile code to check that subscripts are within declared array bounds.
|
1996-05-15 20:27:10 +00:00
|
|
|
.It Fl C++
|
1994-01-05 03:24:01 +00:00
|
|
|
Output C++ code.
|
1996-05-15 20:27:10 +00:00
|
|
|
.It Fl c
|
1994-01-05 03:24:01 +00:00
|
|
|
Include original Fortran source as comments.
|
1996-05-15 20:27:10 +00:00
|
|
|
.It Fl E
|
|
|
|
Declare uninitialized COMMON to be Extern (overridably defined in
|
|
|
|
.Pa f2c.h
|
1994-01-05 03:24:01 +00:00
|
|
|
as
|
1996-05-15 20:27:10 +00:00
|
|
|
.Em extern
|
|
|
|
).
|
|
|
|
.It Fl ec
|
|
|
|
Place uninitialized COMMON blocks in separate files:
|
|
|
|
COMMON ABC appears in file abc_com.c .
|
1994-01-05 03:24:01 +00:00
|
|
|
Option
|
1996-05-15 20:27:10 +00:00
|
|
|
.Fl e1c
|
1994-01-05 03:24:01 +00:00
|
|
|
bundles the separate files
|
|
|
|
into the output file, with comments that give an unbundling
|
1996-05-15 20:27:10 +00:00
|
|
|
.Xr sed 1
|
1994-01-05 03:24:01 +00:00
|
|
|
script.
|
1996-05-15 20:27:10 +00:00
|
|
|
.It Fl e1c
|
|
|
|
See
|
|
|
|
.Fl ec .
|
|
|
|
.It Fl ext
|
|
|
|
Complain about Fortran 77 extensions.
|
|
|
|
.It Fl f
|
1994-01-05 03:24:01 +00:00
|
|
|
Assume free-format input: accept text after column 72 and do not
|
|
|
|
pad fixed-format lines shorter than 72 characters with blanks.
|
1996-05-15 20:27:10 +00:00
|
|
|
.It Fl 72
|
1994-01-05 03:24:01 +00:00
|
|
|
Treat text appearing after column 72 as an error.
|
1996-05-15 20:27:10 +00:00
|
|
|
.It Fl g
|
|
|
|
Include original Fortran line numbers in
|
|
|
|
.Sy #line
|
|
|
|
lines.
|
|
|
|
.It Fl h Ns Op Cm d
|
1994-01-05 03:24:01 +00:00
|
|
|
Emulate Fortran 66's treatment of Hollerith: try to align character strings on
|
|
|
|
word (or, if the option is
|
1996-05-15 20:27:10 +00:00
|
|
|
.Fl hd ,
|
1994-01-05 03:24:01 +00:00
|
|
|
on double-word) boundaries.
|
1996-05-15 20:27:10 +00:00
|
|
|
.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
|
1994-01-05 03:24:01 +00:00
|
|
|
Similar to
|
1996-05-15 20:27:10 +00:00
|
|
|
.Fl \&I2 ,
|
1994-01-05 03:24:01 +00:00
|
|
|
but assume a modified
|
1996-05-15 20:27:10 +00:00
|
|
|
.Em libF77
|
1994-01-05 03:24:01 +00:00
|
|
|
and
|
1996-05-15 20:27:10 +00:00
|
|
|
.Em libI77
|
1994-01-05 03:24:01 +00:00
|
|
|
(compiled with
|
1996-05-15 20:27:10 +00:00
|
|
|
.Fl Df2c_i2 ),
|
|
|
|
so INTEGER and LOGICAL variables may be assigned by INQUIRE and array lengths
|
|
|
|
are stored in short ints
|
|
|
|
.It Fl kr Ns Op Cm d
|
1994-01-05 03:24:01 +00:00
|
|
|
Use temporary values to enforce Fortran expression evaluation
|
|
|
|
where K&R (first edition) parenthesization rules allow rearrangement.
|
|
|
|
If the option is
|
1996-05-15 20:27:10 +00:00
|
|
|
.Fl krd ,
|
1994-01-05 03:24:01 +00:00
|
|
|
use double precision temporaries even for single-precision operands.
|
1996-10-22 05:36:57 +00:00
|
|
|
.It Fl o Ar name
|
|
|
|
The C source code is written into file
|
|
|
|
.Ar name .
|
1996-05-15 20:27:10 +00:00
|
|
|
.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
|
1994-01-05 03:24:01 +00:00
|
|
|
Write a
|
1996-05-15 20:27:10 +00:00
|
|
|
.Ar file Ns \&.P
|
|
|
|
of ANSI (or C++) prototypes for definitions in each input
|
|
|
|
.Ar file Ns \&.f
|
1994-01-05 03:24:01 +00:00
|
|
|
or
|
1996-05-15 20:27:10 +00:00
|
|
|
.Ar file Ns \&.F .
|
|
|
|
When reading Fortran from standard input, write prototypes at the beginning of
|
|
|
|
standard output. Option
|
|
|
|
.Fl Ps
|
1994-01-05 03:24:01 +00:00
|
|
|
implies
|
1996-05-15 20:27:10 +00:00
|
|
|
.Fl P
|
1994-01-05 03:24:01 +00:00
|
|
|
and gives exit status 4 if rerunning
|
1996-05-15 20:27:10 +00:00
|
|
|
.Nm f2c
|
1994-01-05 03:24:01 +00:00
|
|
|
may change prototypes or declarations.
|
1996-05-15 20:27:10 +00:00
|
|
|
.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
|
1994-01-05 03:24:01 +00:00
|
|
|
Cast values of REAL functions (including intrinsics) to REAL.
|
1996-05-15 20:27:10 +00:00
|
|
|
.It Fl r8
|
|
|
|
Promote REAL to DOUBLE PRECISION, COMPLEX to DOUBLE COMPLEX.
|
|
|
|
.It Fl s
|
|
|
|
Preserve multidimensional subscripts.
|
|
|
|
.It Fl T Ar dir
|
1994-01-05 03:24:01 +00:00
|
|
|
Put temporary files in directory
|
1996-05-15 20:27:10 +00:00
|
|
|
.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
|
1994-01-05 03:24:01 +00:00
|
|
|
Assume
|
1996-05-15 20:27:10 +00:00
|
|
|
.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
|
1994-01-05 03:24:01 +00:00
|
|
|
(\e", \e', \e0, \e\e, \eb, \ef, \en, \er, \et, \ev) in character strings.
|
1996-05-15 20:27:10 +00:00
|
|
|
.It Fl !c
|
1994-01-05 03:24:01 +00:00
|
|
|
Inhibit C output, but produce
|
1996-05-15 20:27:10 +00:00
|
|
|
.Fl P
|
1994-01-05 03:24:01 +00:00
|
|
|
output.
|
1996-05-15 20:27:10 +00:00
|
|
|
.It Fl !I
|
1994-01-05 03:24:01 +00:00
|
|
|
Reject
|
1996-05-15 20:27:10 +00:00
|
|
|
.Sy include
|
1994-01-05 03:24:01 +00:00
|
|
|
statements.
|
1996-05-15 20:27:10 +00:00
|
|
|
.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
|
1994-01-05 03:24:01 +00:00
|
|
|
or
|
1996-05-15 20:27:10 +00:00
|
|
|
.Xr cc 1
|
|
|
|
and the following libraries need to specified:
|
|
|
|
.Fl lf2c lm .
|
|
|
|
.Sh FILES
|
|
|
|
.Ar file Ns \&.[fF]
|
1994-01-05 03:24:01 +00:00
|
|
|
input file
|
1996-05-15 20:27:10 +00:00
|
|
|
|
|
|
|
.Ar file Ns \&.c
|
1994-01-05 03:24:01 +00:00
|
|
|
output file
|
1996-05-15 20:27:10 +00:00
|
|
|
|
|
|
|
.Pa /usr/include/f2c.h
|
1994-01-05 03:24:01 +00:00
|
|
|
header file
|
1996-05-15 20:27:10 +00:00
|
|
|
|
|
|
|
.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
|
1994-01-05 03:24:01 +00:00
|
|
|
The diagnostics produced by
|
1996-05-15 20:27:10 +00:00
|
|
|
.Nm f2c
|
1994-01-05 03:24:01 +00:00
|
|
|
are intended to be
|
|
|
|
self-explanatory.
|
1996-05-15 20:27:10 +00:00
|
|
|
.Sh BUGS
|
1994-01-05 03:24:01 +00:00
|
|
|
Floating-point constant expressions are simplified in
|
|
|
|
the floating-point arithmetic of the machine running
|
1996-05-15 20:27:10 +00:00
|
|
|
.Nm f2c
|
1994-01-05 03:24:01 +00:00
|
|
|
so they are typically accurate to at most 16 or 17 decimal places.
|
1996-05-15 20:27:10 +00:00
|
|
|
.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 .
|