[net.lang.f77] Translator from Rat4 to F77?

spk@lanl.ARPA (05/31/85)

	Does anyone know of a piece of processing software
that can tranlate Rat4 to FORTRAN-77? (or which can translate
FORTRAN-66 to FORTRAN-77?)  The software section in the
Computer Graphics Group here at LANL is interested in converting
a lot of our graphics software to F77.  Any direction or help
that you might be able to give us is greatly appreciated.


					Stephen Kramer (spk@lanl.ARPA)
					MS B272, Computer Graphics Group
					Los Alamos National Laboratory
					Los Alamos, NM  87545
					(505) 667-4196

russell@acf4.UUCP (Bill Russell) (05/31/85)

Go to the nearest manual rack at lanl devoted to CDC Cyber Nos software
and see the following manual:

	Fortran Extended Version 4 to
	Fortran Version 5
	Conversion Aid Program Version 1 Reference Manual
	CDC Order Number: 60483000

When this product first came out, Richard Friedman, than at LBL, now at
Pacific Sierra Research, said that this product was great for converting
CDC Fortran 4 to Fortran 77, which was then usable on Vaxes, etc.

Fortran Extended Version 4 == Fortran 66
Fortran Version 5          == Fortran 77

The product will do a fairly good job, and points out the items it
cannot convert due to hardware or portability problems.

One of the things is does nicely is:

F66:	M=23B+5634B
F77:	M=O"23"+O"5634"

west@sdcsla.UUCP (Larry West) (06/03/85)

In article <2850003@acf4.UUCP> russell@acf4.UUCP (Bill Russell) writes:
  > ...
  > 	Fortran Extended Version 4 to
  > 	Fortran Version 5
  > 	Conversion Aid Program Version 1 Reference Manual
  > 	CDC Order Number: 60483000
  > 
  > ... this product was great for converting
  > CDC Fortran 4 to Fortran 77, which was then usable on Vaxes, etc.
  > 
  > Fortran Extended Version 4 == Fortran 66
  > Fortran Version 5          == Fortran 77
  > 
  > ...
  > One of the things is does nicely is:
  > 
  > F66:	M=23B+5634B
  > F77:	M=O"23"+O"5634"

However, one should be aware that this notation for octal is
not part of the language standard.   It may work on VMS fortran
77, and perhaps others.   (All I've seen on VMS is: "23+"5634).

Still, this is a minor point, and one could easily transform
the output of the translator (e.g., in this case, by replacing
the octal notation with decimal).

-- 

Larry West			Institute for Cognitive Science
(USA+619-)452-6220		UC San Diego (mailcode C-015) [x6220]
ARPA: <west@nprdc.ARPA>		La Jolla, CA  92093  U.S.A.
UUCP: {ucbvax,sdcrdcf,decvax,ihnp4}!sdcsvax!sdcsla!west OR ulysses!sdcsla!west

wcs@ho95b.UUCP (Bill Stewart) (06/05/85)

Assuming that by "Rat4" you mean the Ratfor language, the software you want
is called "ratfor", and lives on System 3, System V, 4.1BSD, and probably
4.2BSD(?).  It takes an input language consisting of old-fortran plus some
decent control structures (if-then-else, while, C-style for(;;),...)
and handles free-format input and some other preprocessor stuff.
The output is vanilla fortran 77, assuming that the input wasn't fortran-66
dependent (e.g. one-trip do-loops, etc.).

john@moncol.UUCP (John Ruschmeyer) (06/05/85)

>From: wcs@ho95b.UUCP (Bill Stewart)
>Organization: AT&T Bell Labs, Holmdel NJ
>Message-ID: <453@ho95b.UUCP>
>
>Assuming that by "Rat4" you mean the Ratfor language, the software you want
>is called "ratfor", and lives on System 3, System V, 4.1BSD, and probably
>4.2BSD(?).  It takes an input language consisting of old-fortran plus some
>decent control structures (if-then-else, while, C-style for(;;),...)
>and handles free-format input and some other preprocessor stuff.
>The output is vanilla fortran 77, assuming that the input wasn't fortran-66
>dependent (e.g. one-trip do-loops, etc.).

Hmmm... Has Ratfor been improved in the last few years? The Ratfor which
came with our v7 system produces FORTRAN 66 as its output, not f77.

This means that the resulting program is often a maze of GOTO's.


-- 
Name:		John Ruschmeyer
US Mail:	Monmouth College, W. Long Branch, NJ 07764
Phone:		(201) 222-6600 x366
UUCP:		...!vax135!petsd!moncol!john	...!princeton!moncol!john
						   ...!pesnta!moncol!john
Silly Quote:
		I never wanted to be a barber.
		I wanted to be... a LUMBERJACK!

guy@sun.uucp (Guy Harris) (06/07/85)

> >and handles free-format input and some other preprocessor stuff.
> >The output is vanilla fortran 77, assuming that the input wasn't fortran-66
> >dependent (e.g. one-trip do-loops, etc.).
> 
> Hmmm... Has Ratfor been improved in the last few years? The Ratfor which
> came with our v7 system produces FORTRAN 66 as its output, not f77.
> 
> This means that the resulting program is often a maze of GOTO's.

F66 is pretty much a proper subset of F77; that's the sense in which Rat4
produces F77.  It produces code that should be compilable under either
compiler, assuming that the "plain FORTRAN" part of the code is compilable
under either compiler.

Actually, one-trip do-loops weren't a part of F66; the F66 spec didn't say
what happened if the index would move away from the terminating value.  A
number of compilers took advantage of this and implemented one-trip loops.
F77 plugged that hole, although some manufacturer complained about it;
fortunately, nobody listened to them.

	Guy Harris

john@moncol.UUCP (John Ruschmeyer) (06/09/85)

>From: guy@sun.uucp (Guy Harris)
>Organization: Sun Microsystems, Inc.
>Message-ID: <2281@sun.uucp>
>
>> >and handles free-format input and some other preprocessor stuff.
>> >The output is vanilla fortran 77, assuming that the input wasn't fortran-66
>> >dependent (e.g. one-trip do-loops, etc.).
>> 
>> Hmmm... Has Ratfor been improved in the last few years? The Ratfor which
>> came with our v7 system produces FORTRAN 66 as its output, not f77.
>> 
>> This means that the resulting program is often a maze of GOTO's.
>
>F66 is pretty much a proper subset of F77; that's the sense in which Rat4
>produces F77.  It produces code that should be compilable under either
>compiler, assuming that the "plain FORTRAN" part of the code is compilable
>under either compiler.

[The following is a response to the above and to a mail reply I recieved.]

I concede that the output of the RATFOR processor is f77 in that it will
compile and run correctly with a FORTRAN 77 compiler. (On some compilers,
the one-trip DO loop is a compile-time option.)

I still maintain, however, that the output is really FORTRAN 66 in that it
takes advantage of none of the features added in f77, such as the
IF-THEN-ELSE construct.


Now, why is this important to me? On one of our non-UNIX systems, we run a
financial simulation program which was written in the early 1960's
(FINANSIM by Greenleaf et al.). This program was written in *really* old
FORTRAN and uses constructs such as the arithmetic-IF. Needless to say, it
is nearly impossible to read.

For the hell of it, I took a copy of it over to our UNIX system and ran it
through struct. Voila, very readable RATFOR. It was actually possible to
follow what the program was doing.

Then I ran the program back through RATFOR. Yeech-o, lots and lots of
GOTO's. All those nice RATFOR if-then-else's gone in an instant. The result
was as bad, if not worse, than the original.

I realize that normally the trick would be to do the program maintenance on
the RATFOR code. Since we're dealing with a system that doesn't support it,
however, the next best thing would be to use as much f77 capability as
possible.


-- 
Name:		John Ruschmeyer
US Mail:	Monmouth College, W. Long Branch, NJ 07764
Phone:		(201) 222-6600 x366
UUCP:		...!vax135!petsd!moncol!john	...!princeton!moncol!john
						   ...!pesnta!moncol!john
Silly Quote:
		"I wanted to call it 'Nautical Lady' and Fred wanted
		 to call it 'Queen of the Sea'. So we took the first
		 three letters of my name and the last three letters
		 of his."

frodo@wcom.UUCP (Jim Scardelis) (06/10/85)

> 
> Then I ran the program back through RATFOR. Yeech-o, lots and lots of
> GOTO's. All those nice RATFOR if-then-else's gone in an instant. The result
> was as bad, if not worse, than the original.
> 
> I realize that normally the trick would be to do the program maintenance on
> the RATFOR code. Since we're dealing with a system that doesn't support it,
> however, the next best thing would be to use as much f77 capability as
> possible.
> 

	There are a couple of versions of RATFOR written in RATFOR, which
can then be translated to f77, and ported to whatever system you have. At
least one of them is public domain.

	Now, if I can only remember what I did with my copy of it......
-- 
				Jim Scardelis
uucp: {vax135|ihnp4}!timeinc!wcom!frodo		
ARPA: 1891@NJIT-EIES.MAILNET@MIT-MULTICS.ARPA
"The opinions expressed herein are those of my computer, and not necessarily
      those of myself, Warner Computer Systems, or any other computer or
        company along the line. "

chris@umcp-cs.UUCP (Chris Torek) (06/11/85)

You can't possibly be on a system that supports Fortran but not Ratfor,
since Ratfor is written *in* Fortran.  (Isn't there a DECUS version of
Ratfor?  In any case I'm sure I've heard of several public domain Ratfor
translators.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland

guy@sun.uucp (06/11/85)

> >> Hmmm... Has Ratfor been improved in the last few years? The Ratfor which
> >> came with our v7 system produces FORTRAN 66 as its output, not f77.
> >> 
> >> This means that the resulting program is often a maze of GOTO's.
> >
> >F66 is pretty much a proper subset of F77; that's the sense in which Rat4
> >produces F77.  It produces code that should be compilable under either
> >compiler, assuming that the "plain FORTRAN" part of the code is compilable
> >under either compiler.
> 
> I still maintain, however, that the output is really FORTRAN 66 in that it
> takes advantage of none of the features added in f77, such as the
> IF-THEN-ELSE construct.
> (Discussion of using "struct" followed by "ratfor" as a technique for
> turning extremely old unstructured FORTRAN into structured F77)

A tool to do the aforementioned transformation might be nice, but it's not
what RATFOR was intended as.  RATFOR was intended as a way to write
structured FORTRAN even if you had an F66 compiler; in fact, I believe the
Software Tools book gives an address to send away to to get a RATFOR
preprocessor written in F66.  As such, there wasn't much motivation to make
a RATFOR preprocessor that uses block IF.  (Besides, nobody's done much with
the UNIX RATFOR preprocessor in a while; the only difference between the
4.2BSD "ratfor" and the S5R2 "ratfor", other than the shape of SCCS IDs and
other minor cosmetic changes, is a small tweak to avoid generating redundant
"goto"s.)  It was never intended to be used as part of a structuring tool to
take old FORTRAN and turn it into F77.  If you want such a tool, why not
dive into "struct" and make a version that generates F77 instead of RATFOR?

	Guy Harris

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (06/16/85)

> I realize that normally the trick would be to do the program maintenance on
> the RATFOR code. Since we're dealing with a system that doesn't support it,
> however, the next best thing would be to use as much f77 capability as
> possible.

??  If your system supports Fortran, it can readily support Ratfor.
Contact:
	Software Tools Users Group
	140 Center St.
	El Segundo, CA 90245
	(213)322-2574