[comp.lang.fortran] ratfor to f77 preprocessor

scott@bu-ma.bu.edu (Scott Sutherland) (12/19/87)

Does anyone have (or know where I can get) a ratfor that produces f77?
I like using ratfor, but debugging is a pain because of the ugly
old-style fortran it produces.  Can anyone help? This is for a Sun 3
system.

	Scott Sutherland			scott@bu-ma.bu.edu
	Boston University Math Department
	(617)353-5288

pete@tsc.DEC.COM (Pete Schmitt) (12/20/87)

In article <871218123142@euler>, scott@bu-ma.bu.edu (Scott Sutherland) writes:
> 
> Does anyone have (or know where I can get) a ratfor that produces f77?
> I like using ratfor, but debugging is a pain because of the ugly
> old-style fortran it produces.  Can anyone help? This is for a Sun 3
> system.
> 
f77 if given a *.r file assumes that the file is ratfor and convert it
to f77.  I believe this is the way it was implemented on UNIX by the
guys at Bell Labs.

-- 
            \\\!///		From: Pete Schmitt
             _   _ 		UUCP: ihnp4!tsc!pete
           ( Q   Q )		It's okay to say the U... word.
 ---,,,,-------U-------,,,,---	

scott@bu-ma.bu.edu (Scott Sutherland) (12/21/87)

In article <254@tsc.DEC.COM> pete@tsc.DEC.COM (Pete Schmitt) writes:
]
] In article <871218123142@euler>, scott@bu-ma.bu.edu (Scott Sutherland) writes:
] > 
] > Does anyone have (or know where I can get) a ratfor that produces f77?
] > I like using ratfor, but debugging is a pain because of the ugly
] > old-style fortran it produces.  Can anyone help? This is for a Sun 3
] > system.
] > 
] f77 if given a *.r file assumes that the file is ratfor and convert it
] to f77.  I believe this is the way it was implemented on UNIX by the
] guys at Bell Labs.
]

I guess I wasn't too clear in my request.
When I said "produces f77", I really meant "produces code that takes
advantage of f77 constructs".  The main problem here is when I want to
use a debugger, in which case I have to compile by first getting
ratfor to build a .f file, then invoking f77 on that file (so that the
source matches the symbols built by the -g option).  The problem is
that the fortran produced by ratfor  doesn't use if/else constructs
and so on, so the code I debug is much more spaghetti-like than it
needs to be.  In fact, aside from the debugging problem, I can't get
ratfor to accept certain valid f77 constructs, for example

if (a.eq.b) ...
elseif (a.lt.b) ...
else ...
endif

Of course, I can code around these things, I'd just rather not.


Andrew Kailhofer at Wisconsin has suggested I use efl instead; Sun
doesn't ship efl as part of the standard distribution -- If somebody
knows of a PD efl implementation, I'd be willing to look at that too.

levy@ttrdc.UUCP (Daniel R. Levy) (12/21/87)

In article <254@tsc.DEC.COM>, pete@tsc.DEC.COM (Pete Schmitt) writes:
#> f77 if given a *.r file assumes that the file is ratfor and convert it
#> to f77.  I believe this is the way it was implemented on UNIX by the
#> guys at Bell Labs.
#>             \\\!///		From: Pete Schmitt
#>              _   _ 		UUCP: ihnp4!tsc!pete
#>            ( Q   Q )		It's okay to say the U... word.
#>  ---,,,,-------U-------,,,,---	

/usr/bin/f77 calls /usr/bin/ratfor for `.r' files, my friend.

(It's OK to say the V.. word)
-- 
|------------Dan Levy------------|  Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
|         an Engihacker @        |  	<most AT&T machines>}!ttrdc!ttrda!levy
| AT&T Computer Systems Division |  Disclaimer?  Huh?  What disclaimer???
|--------Skokie, Illinois--------|

acphssrw@csun.UUCP (Stephen R. Walton) (12/22/87)

In article <871220161548@euler> scott@bu-ma.bu.edu (Scott Sutherland) writes:
>The main problem here is when I want to
>use a debugger, in which case I have to compile by first getting
>ratfor to build a .f file, then invoking f77 on that file (so that the
>source matches the symbols built by the -g option). 

The f77 compiler on BSD and descendants actually understands the #
<line number> <file> construct of C, and so ratfor could theoretically
produce an object file which would refer to the ratfor source rather
than the generated Fortran.  Just a thought, for anyone who might like
to hack on it.  (I uncovered this fact when I tried to use the .F
extension, which causes f77 to run cpp on your Fortran source before
it is compiled.  Worked, except that I wound up with the name of the
generated .f file rather than the original .F file, which caused the
same problem Scott describes.)