From C to FORTRAN with FORTRIX

Forrest Young fwy at ecsvax.UUCP
Fri Dec 28 05:56:37 AEST 1984


I have received about a dozen responses to my question about converting
C to FORTRAN, and about the Fortrix converter.  This message summarizes the
responses and presents excerpts.

Summary:

I received three brief completely favorable responses. Mostly, these argued
that 30,000 lines converted for $2000 has to be worth it no matter what the
conversion quality.  I received  four detailed responses from Fortrix users 
which were either mixed or negative. I received one suggestion to use Xenix
RATFOR (claimed to produce C output rather than FORTRAN!), and one
response saying that conversions shouldn`t be made if the program is
a scientific or mathematical program.

Question:  Is that true about Xenix RATFOR?

Excerpts:  Names of people and organizations have been removed to protect the 
	   innocent (or guilty).


Response 1:

We also have a large package which we would like to convert from Fortran
to C.  Earlier this year we contacted Fortrix, and they installed it on our
system via modem.  We encountered the following problems:

-- Fortrix can only handle 1 program unit per file.  Our program
consists of about 800 routines in 100 files, so this was a major
problem.

-- Fortrix doesn't understand common blocks and equivalence statements.
This was fatal since our program has a couple of thousand global
variables.

-- Fortrix doesn't understand tabs!

-- It's slow and cumbersome.  It consists of a couple of programs plus
awk/sed/shell scripts.

-- The output seems to require massive hand editing.  If you have to do
that, you might as well do the conversion by hand.  (What a lot of
people do is to put the Fortran through struct and hand edit the Ratfor
into C -- we were hoping that Fortrix would be just like struct but generate
C output.  Too bad it wasn't implemented that way.)

We got our deposit back (after a couple of months) and happily rm -rf'ed
the directory.


Response 2:

We looked into FORTRIX, and in fact even have a copy.  None of us, that I know 
of, has had lots of time to look at it, but I can give you some information.

It has some design flaws that the company has promised to fix, at least
for us.  The major one was that it is designed for one user, and you need
a password to use it.  We have hundreds of users, and having them all
remember yet another password is untenable.  The company agreed that if
it were installed on our Unix VAX with execute privileges for everyone
but the owner they would be satisfied; they are giving us a version
without the password.


Response 3:

Good:
	writes well indented code

	600 lines per minute

Bad:
	Can not handle:
		1) Free form reads and writes
		2) Dimension a(...) must be Real a(...), etc.
		3) Things must be typed everywhere, else a problem
			(I do not fully understand this one)
		4) Data statements
		5) Assigned go to
		6) Backspace
		7) Holleriths
		8) Common
		9) Equivalence
		10) Constants as arguments to subroutines

	Does one subroutine at a time


Response 4:

FORTRIX seems to be a useful tool that can cut down on the time required to 
convert code, but it will not do everything.  It works better on well 
structured, standard FORTRAN than on garbled FORTRAN (don't we all?).  
A two month conversion job could be cut to two weeks with FORTRIX.


Response 5:

Xenix for the AT comes with a RATFOR compiler, which unlike other RATFORs,
converts to C source (I beleive normal RATFOR converts to normal (unrational?)
FORTRAN).  I haven't tried it yet, but I would think that RATFOR would be
a superset of FORTRAN, and therefore would understand normal FORTRAN, and
in the case of the Xenix RATFOR, would act as a FORTRAN to C converter.



More information about the Comp.lang.c mailing list