Fortran to C Translation
Is anyone aware of a FOSS DEC Fortran to Gnu C translator?
I have the source code for the FCC's old Engineering Database, originally written in Fortran, for the VAX. The Commission converted to a Sybase platform, and used an (expensive) proprietary Fortran to C translator. The new system has neat features, like method of moments antenna analysis, but the price of the converter is beyond solo engineering practices. Any ideas? Thanks! bsD |
I use gfortran all the time. It is my understanding that the fortran code is converted to C code and then compiled with gcc. I'll see if I can find out more about this and report back. Gotta go for now.
|
Thanks! :hattip:
|
Well, so far, in reading the gfortran documentation, I have not found anything (like a compiler option) to generate an intermediate file containing the C code. Documentation for gfortran is located at https://gcc.gnu.org/onlinedocs/ or, if you have gfortran installed, the command
Code:
gfortran --target-help|less |
Quote:
All the compilers of the gcc suite (g++, gnat, go, objc, etc) work that way: the FRONTend is language specific, the backend is common. So there's no real translating between languages, everything is compiled into this intermediate language. PS: the backend is architecture specific, there's one for Intel (x86), for ARM, etc. BTW: there is a "f2c" program, but that's for (the first version of) Fortran/77, not newer specs. See for that en.wikipedia.org/wiki/F2c and www.netlib.org/f2c/ |
Quote:
Have you found any recent demos for commercial products that might work? Yes, they may be handcuffed in much the same way as the Cobalt Blue demo I used but it might get you started down the path of converting it yourself. I say that not having any idea how many lines of code you're faced with converting. (Sounds like it might be a lot.) It's not quick to do yourself but far from impossible. If you can find a gfortran switch that creates/saves the intermediate C code (I haven't found one yet) I do recall from back in my PDP-11 days that intermediate code output can be about the ugliest code you can imagine. At least the output of the IFTRAN translator we used on RSX-11 surely was. The FORTRAN-IV created from the IFTRAN "structured programming" sources was almost unreadable (and the resulting MACRO-11 was even worse). Good luck... |
Quote:
Code:
program hello Cheers... |
ehartman: Thank you for setting me straight on that. I don't know where I got the idea.
I see that f2c is still in the Debian repository: Code:
apt list --all-versions|grep f2c Code:
f2c/oldstable 20100827-3 amd64 Code:
apt show f2c/oldstable Code:
Package: f2c |
Busy li'l daemon...
First, thanks to all for pointing me in the right direction on this code conversion project! It looks like f2c may be just what I've been looking for. Not that it's going to be a panacea...I snarfed the source this morning, and built it on wintermute (my Slackware development box), and tried converting a couple of subroutines with it.
It took a few bites of old DEC Fortran, and acted like a cat with a VERY large hairball. <cough>..<HeAvE!!>...AACCCKKKKKKKKKKKK!!!!! (plop!). As I said in an earlier post, this old app is loaded with poor syntax, uncommented kludges, and computed GO TO's , which make f2c shit kittens. So I'm cobbling together some perl to clean the cruft up, and as it's not the fastest thing I've seen, and I don't want to tie up a production box with this, I'm going to move everything over to the Octane2, and just let it run. I may have something fit to feed GCC++ by next weekend. :party: Cheers! BS.d |
All times are GMT -5. The time now is 10:22 AM. |