[comp.sys.amiga] Information: f2c translator

11TSTARK@GALLUA.BITNET ("Timothy Stark ", Picard) (03/20/90)

Hello Amiga users:

   Someone requested me about where is f2c software. Well, I will conlude
information about f2c software. It is avaliable at research.att.com under
directory dist/f2c. For you do not have access to anonymous ftp, you
can send command to its file server:

To: NETLIB@RESEARCH.ATT.COM

send index from f2c

That's index file from its executed command:

====== index for f2c ============

f2c.h   Include file necessary for compiling output of the converter.
        See the second NOTE below.

f2c.1   Man page for f2c.

f2c.1t  Source for f2c.1 (to be processed by troff -man or nroff -man).

libf77  Library of non I/O support routines the generated C may need.
        Fortran main programs result in a C function named MAIN__ that
        is meant to be invoked by the main() in libf77.

libi77  Library of Fortran I/O routines the generated C may need.
        Note that some vendors (e.g., BSD, Sun and MIPS) provide a
        libF77 and libI77 that are incompatible with f2c -- they
        provide some differently named routines or routines with the
        names that f2c expects, but with different calling sequences.
        On such systems, the recommended procedure is to merge
        libf77 and libi77 into a single library, say libf2c, and
        install it where you can access it by specifying -lf2c .

f2c/src Source for the converter itself, including a file of checksums
        and source for a program to compute the checksums (to verify
        correct transmission of the source), is available: ask netlib to
                send all from f2c/src
        If the checksums show damage to just a few source files, or if
        the change log file (see "fixes" below) reports corrections to
        some source files, you can request those files individually
        "from f2c/src".  For example, to get defs.h and xsum0.out, you
        would ask netlib to
                send defs.h xsum0.out from f2c/src
        "all from f2c/src" is 633613 bytes long.

        Tip: if asked to send over 99,000 bytes in one request, netlib
        breaks the shipment into 1000 line pieces and sends each piece
        separately (since otherwise some mailers might gag).  To avoid
        the hassle of reassembling the pieces, try to keep each request
        under 99,000 bytes long.  The final number in each line of
        xsum0.out gives the length of each file in f2c/src.  For
        example,
                send exec.c expr.c from f2c/src
                send format.c format_data.c from f2c/src
        will give you slightly less hassle than
                send exec.c expr.c format.c format_data.c from f2c/src

f2c.ps  As soon as our release process allows (probably sometime in
        April, 1990), postscript for a technical report on f2c.

fixes   The complete change log, reporting bug fixes and other changes.
        (Some recent change-log entries are given below).

fc      A shell script that uses f2c and imitates much of the behavior
        of commonly found f77 commands.  You will almost certainly
        need to adjust some of the shell-variable assignments to make
        this script work on your system.


NOTE:   For now, you may exercise f2c by sending netlib a message whose
        first line is "execute f2c" and whose remaining lines are
        the Fortran 77 source that you wish to have converted.
        Return mail brings you the resulting C, with f2c's error
        messages between #ifdef uNdEfInEd and #endif at the end.
        (To understand line numbers in the error messages, regard
        the "execute f2c" line as line 0.  It is stripped away by
        the netlib software before f2c sees your Fortran input.)
        Options described in the man page may be transmitted to
        netlib by having the first line of input begin with "c$f2c ",
        followed by the desired options, e.g., "c$f2c -R -u".
        This scheme may change -- ask netlib to
               send index from f2c
        if you do not get the behavior you expect.

        During the initial experimental period, incoming Fortran
        will be saved in a file.  Don't send any secrets!


BUGS:   Please send bug reports (including the shortest example
        you can find that illustrates the bug) to research!dmg
        or dmg@research.att.com .


NOTE:   f2c.h defines several types, e.g., real, integer, doublereal.
        The definitions in f2c.h are suitable for most machines, but if
        your machine has sizeof(double) > 2*sizeof(long), you may need
        to adjust f2c.h appropriately.  f2c assumes
                sizeof(doublecomplex) = 2*sizeof(doublereal)
                sizeof(doublereal) = sizeof(complex)
                sizeof(doublereal) = 2*sizeof(real)
                sizeof(real) = sizeof(integer)
                sizeof(real) = sizeof(logical)
                sizeof(real) = 2*sizeof(shortint)
        EQUIVALENCEs may not be translated correctly if these
        assumptions are violated.

        There exists a C compiler that objects to the lines
                typedef VOID C_f;       /* complex function */
                typedef VOID H_f;       /* character function */
                typedef VOID Z_f;       /* double complex function */
        in f2c.h .  If yours is such a compiler, do two things:
        1. Complain to your vendor about this compiler bug.
        2. Find the line
                #define VOID void
           in f2c.h and change it to
                #define VOID int
        (For readability, the f2c.h lines shown above have had two
        tabs inserted before their first character.)

FTP:    All the material described above is now available by anonymous
        ftp from research.att.com -- look in dist/f2c .  You must
        uncompress the .Z files once you have a copy of them, e.g., by
                uncompress *.Z

-----------------
Recent change log (partial)
-----------------

7 Jan. 1990:
  libi77: routines supporting NAMELIST added.  Surrounding quotes
made optional when no ambiguity arises in a list or namelist READ
of a character-string value.

9 Jan. 1990:
  f2c/src made available.

16 Jan. 1990:
  New options -P to produce ANSI C or C++ prototypes for procedures
defined.  Change to -A and -C++: f2c tries to infer prototypes for
invoked procedures unless the new -!P option is given.  New warning
messages for inconsistent calling sequences among procedures within
a single file.  Most of f2c/src is affected.
  f2c.h: typedefs for procedure arguments added; netlib's f2c service
will insert appropriate typedefs for use with older versions of f2c.h.

24 Jan. 11:44:00 EST 1990:
  New feature: -P emits comments showing COMMON block lengths, so one
can get warnings of incompatible COMMON block lengths by having f2c
read .P (or .p) files.  Now by running f2c twice, first with -P -!c
(or -P!c),  then with *.P among the arguments, you can be warned of
inconsistent COMMON usage, and COMMON blocks having inconsistent
lengths will be given the maximum length.  (The latter always did
happen within each input file; now -P lets you extend this behavior
across files.)

26 Jan. 16:44:00 EST 1990:
  Option -P now includes information about references, i.e., called
procedures, in the prototype files (in the form of special comments).
This allows iterative invocations of f2c to infer more about untyped
external names, particularly when multiple Fortran files are involved.

28 Jan. 18:32:00 EST 1990:
  libf77, libi77: checksum files added; "make check" looks for
transmission errors.  NAMELIST read modified to allow $ rather than &
to precede a namelist name, to allow $ rather than / to terminate
input where the name of another variable would otherwise be expected,
and to regard all nonprinting ASCII characters <= ' ' as spaces.

29 Jan. 02:11:00 EST 1990:
  "fc from f2c" added.
  New option -Ps implies -P and returns exit status 4 if rerunning
f2c -P with prototype inputs might change prototypes or declarations.
Now you can execute a crude script like

        cat *.f >zap.F
        rm -f zap.P
        while :; do
                f2c -P -!c zap.[FP]
                case $? in 4) ;; *) break;; esac
                done

to get a file zap.P of the best prototypes f2c can determine for *.f .

Feb 10 00:19:38 EST 1990:
  Insert (integer) casts when floating-point expressions are used
as subscripts.
  Make SAVE stmt (with no variable list) override -a .
  Minor cleanups: change field to Field in struct Addrblock (for the
benefit of buggy C compilers); omit system("/bin/cp ...") in misc.c .

Feb 14 14:02:00 EST 1990:
  Various cleanups (invisible on systems with 4-byte ints), thanks
to Dave Regan: vaxx.c eliminated; %d changed to %ld various places;
external names adjusted for the benefit of stupid systems (that ignore
case and recognize only 6 significant characters in external names);
buffer shortened in xsum.c (e.g. for MS-DOS); fopen modes distinguish
text and binary files; several unused functions eliminated; missing
arg supplied to an unlikely fatalstr invocation.

Thu Feb 15 19:15:53 EST 1990:
  More cleanups (invisible on systems with 4 byte ints); casts inserted
so most complaints from cyntax(1) and lint(1) go away; a few (int)
versus (long) casts corrected.

Fri Feb 16 19:55:00 EST 1990:
  Recognize and translate unnamed Fortran 8x do while statements.
  Fix bug that occasionally caused improper breaking of character
strings.
  New error message for attempts to provide DATA in a type-declaration
statement.

Sat Feb 17 11:43:00 EST 1990:
  Fix infinite loop clf -> Fatal -> done -> clf after I/O error.
  Change "if (addrp->vclass = CLPROC)" to "if (addrp->vclass == CLPROC)"
in p1_addr (in p1output.c); this was probably harmless.
  Move a misplaced } in lex.c (which slowed initkey()).
  Thanks to Gary Word for pointing these things out.

Sun Feb 18 18:07:00 EST 1990:
  Detect overlapping initializations of arrays and scalar variables
in previously missed cases.
  Treat logical*2 as logical (after issuing a warning).
  Don't pass string literals to p1_comment().
  Correct a cast (introduced 16 Feb.) in gram.expr; this matters e.g.
on a Cray.
  Attempt to isolate UNIX-specific things in sysdep.c (a new source
file).  Unless sysdep.c is compiled with SYSTEM_SORT defined, the
intermediate files created for DATA statements are now sorted in-core
without invoking system().

Tue Feb 20 16:10:35 EST 1990:
  Move definition of binread and binwrite from init.c to sysdep.c .
  Recognize Fortran 8x tokens < <= == >= > <> as synonyms for
.LT. .LE. .EQ. .libI77/README.

Tue Feb 20 21:44:07 EST 1990:
  Minor cleanups for the benefit of EBCDIC machines -- try to remove
the assumption that 'a' through 'z' are contiguous.  (Thanks again to
Gary Word.)  Also, change log2 to log_2 (shouldn't be necessary).

Thu Feb 22 17:29:12 EST 1990:
  Allow several entry points to mention the same array.  Protect
parameter adjustments with if's (for the case that an array is not
an argument to all entrypoints).
  Under -u, allow
        subroutine foo(x,n)
        real x(n)
        integer n
  Compute intermediate variables used to evaluate dimension expressions
at the right time.  Example previously mistranslated:
        subroutine foo(x,k,m,n)
        real x(min(k,m,n))
        ...
        write(*,*) x
  Detect duplicate arguments.  (The error msg points to the first
executable stmt -- not wonderful, but not worth fixing.)
  Minor cleanup of min/max computation (sometimes slightly simpler).
  f2c/src files changed:
        defines.h defs.h expr.c format.c init.c main.c output.c p1defs.h
        p1output.c proc.c putpcc.c vax.c version.c xsum0.out

Sun Feb 25 09:39:01 EST 1990:
  Minor tweak to multiple entry points: protect parameter adjustments
with if's only for (array) args that do not appear in all entry points.
  Minor tweaks to format.c and io.c (invisible unless your compiler
complained at the duplicate #defines of IOSUNIT and IOSFMT or at
comparisons of p1gets(...) with NULL).
  f2c/src files changed: format.c io.c vax.c version.c xsum0.out

Sun Feb 25 18:40:10 EST 1990:
  Fix bug introduced Feb. 22: if a subprogram contained DATA and the
first executable statement was labeled, then the label got lost.
(Just change INEXEC to INDATA in p1output.c; it occurs just once.)
  f2c/src files changed: p1output.c version.c xsum0.out

Mon Feb 26 17:45:10 EST 1990:
  Fix bug in handling of " and ' in comments.
  f2c/src files changed: format.c niceprintf.c version.c xsum0.out

THERE WILL LIKELY BE NO FURTHER UPDATES BEFORE THE LAST WEEK OF MARCH.

--------- End of File --------

I hope this information will be useful to you for porting it to Amiga!!!

-- Tim Stark

Timothy Stark          Bitnet: 11tstark@gallua.bitnet People/Link: T.STARK
Gallaudet University   Internet: 11tstark@gallux.gallaudet.edu GEnie: T.STARK1
P.O. Box 1453, 800 Florida Ave., N.E., Washington, DC 20002
"Gallaudet University is the only university for the deaf in the world."