CCL: Cleaning up dusty deck fortran and converting to C/C++



 Sent to CCL by: John McKelvey [jmmckel++attglobal.net]
 --Replace strange characters with the "at" sign to recover email
 address--.
 Andy,
 
Thanks for the suggestions. The issue is that I am collaborating with someone who has his code in C++ and mine is in fortran. He wants it all in C++, so as I am not at all fluent in C of C++ I have taken alternate routes. I have used both tidy and ftnchek to spot dead code; f2c does a good job also.
 Many thanks,
 John
 CCL wrote:
 
 Sent to CCL by: Andrew Fant [fant[#]pobox.com]
 --Replace strange characters with the "at" sign to recover email
 address--.
 CCL wrote:
 
 Sent to CCL by: John McKelvey [jmmckel%a%attglobal.net]
 --Replace strange characters with the "at" sign to recover email
 address--.
 Hello!
 I have some old fortran I would like to convert to C..  Have used F2C on
 
an example code, which had me go back and clean up the fortran first.. not a bad thing.
 Are there any utilities that would take a dusty fortran deck and clean
 it up on its own... i.e. remove unused variables, and the like, for
 example?  I have a 40,000 line F77 code I would like also to run in C.
 Many thanks,
 John McKelvey
 
 John,
   The usual suspects for cleaning up old Fortran are:
 Tidy:  http://www.unb.ca/fredericton/science/chem/ajit/f_tidy.htm
 Ftnchek: http://www.dsm.fordham.edu/~ftnchek/
 and
 Flow/Floppy:  http://www.netlib.org/floppy/contents.html
 As far as specific dead code and dead variable detection, most modern Fortran
 compilers have that capacity built into the optimizer.
 With regards to optimization, you do realize that moving to C or C++ will
 probably make your code less optimized and less optimizable, as well, I am sure.
 And f2c certainly doesn't make for particularly idiomatic c either, as I
 recall.  If the issue is not having access to a good Fortran compiler, you might
 want to take a look at the intel website.  They make available their compilers
 for certain non-commercial uses.   http://www.fortran.com is another good source
 for such things (disclaimer: I know the people who run the company and may hit
 them up for a beer at supercomputing if they get a surge in sales from my
 shameless plug 8-).
 Hope this helps,
 		Andy>