[comp.lang.fortran] Fortran to C Convertor?

pda@rsiatl.UUCP (Paul D. Anderson) (06/13/90)

Does anyone know of a Fortran to C convertor tool?  Or perhaps a
facility that provides such a service?

Thanks!
-paul
-- 
* Paul Anderson * Crossroads Computing * (404) 565-0761 * emory!rsiatl!pda * 
              "SCCS: The condom of promiscuous programmers"

emv@math.lsa.umich.edu (Edward Vielmetti) (06/13/90)

In article <2783@rsiatl.UUCP> pda@rsiatl.UUCP (Paul D. Anderson) writes:

   Does anyone know of a Fortran to C convertor tool?  Or perhaps a
   facility that provides such a service?

try 'f2c'.  here's some info extracted from comp.archives, which
originally appeared in this group in April:

Archive-name: f2c/04-Apr-90
Original-posting-by: mwm@a.gp.cs.cmu.edu (Mark Maimone)
Original-subject: Re: \Fortran to C translator
Archive-site: research.att.com [192.20.225.2]
Archive-directory: dist/f2c
Reposted-by: emv@math.lsa.umich.edu (Edward Vielmetti)

        Source for f2c, a Fortran 77 to C translator jointly developed by
folks from Bell Labs, Bellcore, and Carnegie Mellon, is now freely
available.

        F2c was derived from the original UNIX operating system's f77(1),
and the generated C follows f77's calling conventions; on some machines, the
resulting object files are interchangeable with (and behave
indistinguishably from) objects compiled by f77.  The main "advantage" of
f2c is that it converts ANSI standard Fortran 77 into C without manual
intervention, at least when invoked by a suitable script or makefile (that
may need to exercise an f2c option to ensure that COMMON blocks are defined
just once).  The main "problems" are that f2c does no code restructuring
(e.g., gotos are preserved) and that Fortran I/O gets converted into a bunch
of calls; thus the translated C code doesn't look too pretty, and in general
one would need to maintain the Fortran rather than its translation into C.
[F2c is not meant to displace the services of commercial vendors whose
business is to convert Fortran into maintainable C.]

        There is a plethora of options, many of which exist to support
different compilation environments for the translated C (e.g., ANSI C or C++
compatability, different type sizes, separate files for COMMON blocks to
appease "smart" linkers).  So far f2c (and f2c-generated source) has
compiled successfully on many machines:  Sun, Vax, IBMRT, Apollo, SGI, MIPS,
and Cray to name a few.

        F2c has been under test by the net community for over six months,
and has been verified on the NBS tests, several large math libraries,
floating point tests, even code for laying cable on the ocean floor!

        To find out about f2c, send the following E-mail message to netlib
(netlib@research.att.com or research!netlib):

        send index from f2c

Your message will be answered automatically (by a program -- see CACM vol.
30 #5 (May, 1987), pp. 403-407).  You will receive a reply explaining how to
automatically acquire f2c source (about 600K), f2c library source (130K),
and supporting info (man page, etc).  Or you can anonymous-FTP to
research.att.com and look in directory dist/f2c at these files:

        all.Z -- 250K compressed shar file for f2c
        index -- general info about files
        libf77.Z, libi77.Z -- compressed shar files for libraries

****************************** DISCLAIMER ******************************
             Careful! Anything free comes with no guarantee.
************************************************************************

----------------------------------------------------------------------
Mark Maimone                            phone: (412) 268 - 7698
Carnegie Mellon Computer Science        email: mwm@cs.cmu.edu
                                               cmcspt!mwm@cs.cmu.edu

mwm@a.gp.cs.cmu.edu (Mark Maimone) (06/13/90)

	Here's an update of the post I made in January, now with
anonymous-FTP info.
------------------------------------------------------------------------------
	Source for f2c, a Fortran 77 to C translator jointly developed by
folks from Bell Labs, Bellcore, and Carnegie Mellon, is now freely
available.

	F2c was derived from the original UNIX operating system's f77(1),
and the generated C follows f77's calling conventions; on some machines, the
resulting object files are interchangeable with (and behave
indistinguishably from) objects compiled by f77.  The main "advantage" of
f2c is that it converts ANSI standard Fortran 77 into C without manual
intervention, at least when invoked by a suitable script or makefile (that
may need to exercise an f2c option to ensure that COMMON blocks are defined
just once).  The main "problems" are that f2c does no code restructuring
(e.g., gotos are preserved) and that Fortran I/O gets converted into a bunch
of calls; thus the translated C code doesn't look too pretty, and in general
one would need to maintain the Fortran rather than its translation into C.
[F2c is not meant to displace the services of commercial vendors whose
business is to convert Fortran into maintainable C.]

	There is a plethora of options, many of which exist to support
different compilation environments for the translated C (e.g., ANSI C or C++
compatability, different type sizes, separate files for COMMON blocks to
appease "smart" linkers).  So far f2c (and f2c-generated source) has
compiled successfully on many machines:  Sun, Vax, IBMRT, Apollo, SGI, MIPS,
and Cray to name a few.

	F2c has been under test by the net community for over six months,
and has been verified on the NBS tests, several large math libraries,
floating point tests, even code for laying cable on the ocean floor!

	To find out about f2c, send the following E-mail message to netlib
(netlib@research.att.com or research!netlib):

	send index from f2c

Your message will be answered automatically (by a program -- see CACM vol.
30 #5 (May, 1987), pp. 403-407).  You will receive a reply explaining how to
automatically acquire f2c source (about 600K), f2c library source (130K),
and supporting info (man page, etc).  Or you can anonymous-FTP to
research.att.com and look in directory dist/f2c at these files:

	all.Z -- 250K compressed shar file for f2c
	index -- general info about files
	f2c.ps.Z -- PostScript version of Bell Labs CSTR 149, describing
		    the use and implementation of f2c
	libf77.Z, libi77.Z -- compressed shar files for libraries

****************************** DISCLAIMER ******************************
	     Careful! Anything free comes with no guarantee.
************************************************************************
-- 
----------------------------------------------------------------------
Mark Maimone				phone: (412) 268 - 7698
Carnegie Mellon Computer Science	email: mwm@cs.cmu.edu
grad student, vocal jazz and PDQ Bach enthusiast

fordke@ingr.com (Keith Ford x8614) (06/14/90)

in article <2783@rsiatl.UUCP>, pda@rsiatl.UUCP (Paul D. Anderson) says:
> 
> Does anyone know of a Fortran to C convertor tool?  Or perhaps a
> facility that provides such a service?
> 
I have one that is from AT&T.  Here is a copy of the notice that
appears with the software.  Email me a good email address and I
will bundle it up and send it to you.  I assume you have tar and
compress and uudecode ability.  -kef/MM-

/****************************************************************
Copyright 1990 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.
****************************************************************/


-- 
| fordke@ingr.com,  ...!uunet!ingr!fordke,  sysop@f12.n373.z1.fidonet.org
| Micro Magic BBS (1:373/12 - 205/830-2362) IBM/Apple2/Trackstar/Echoes/News
| "...and the Trees are all kept equal by hatchet, axe, and saw." -Rush