Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.fortran > #73780

converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1

From Lynn McGuire <lynnmcguire5@gmail.com>
Newsgroups comp.lang.fortran, comp.lang.c, comp.lang.c++
Subject converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1
Date 2022-10-23 17:16 -0500
Organization Aioe.org NNTP Server
Message-ID <tj4egb$u68$1@gioia.aioe.org> (permalink)

Cross-posted to 3 groups.

Show all headers | View raw


We are converting a 700,000+ Fortran 77 lines of code plus 50,000+ C++ 
lines of code engineering software product to C++.  With all that code, 
we produce four Win32 EXEs and three Win32 DLLs.  My goal is to add four 
Win64 EXEs and three Win64 DLLs to the product with the same 
capabilities as the Win32 versions (console, windowed, Excel callable, 
Excel embeddable).  Plus support for Unicode named files and Unicode 
file paths.

I am using a customized version of f2c at the moment to automate 60% to 
80% of the conversion from F77 to C++.  I have added support for 
logical*8, changed the output file from *.c to *.cpp, added an include 
for the Fable fem.hpp template library, removed the trailing underscores 
from the subroutine and common block names, removed the ftnlen arguments 
from the character arguments, converted all F77 comments to the // 
instead of the /* */, and a few other items.  If desired, I am willing 
to post a copy of my modified f2c on my website with the source code.
    https://netlib.org/f2c/
    https://en.wikipedia.org/wiki/F2c

f2c does not get me totally there.  The Fortran character strings were 
poorly handled so they will probably needed fixing for proper sizing and 
alignment.  The i/o code is crap so I take the original F77 i/o code and 
translate it by hand.  The arrays in the argument list are still based 
at an index of one so I convert those to base index of zero by hand. 
All of the local and common block arrays were converted to a base index 
of zero by f2c.  I add the new *.cpp file to my Visual Studio project. 
I then add the new function prototypes to my prototypes.h file and I add 
any new common block structures to my commons.h file.  I then compile 
and fix until I get a clean compile.

I have converted over 8,000 lines of F77 code to C++ now.  Several dozen 
subroutines and several dozen common blocks.  Most are compiling cleanly 
in Visual C++ 2015.  My limited testing is working well and I will 
expand my testing when I hit 15,000 or 20,000 lines of F77 code 
converted.  I hoping to get a complete build of the smaller of the Win32 
DLLs by the end of the year and a full build by next June.  One of my 
programmers thinks that we will be lucky to get a complete build by late 
2024.

Lynn

Back to comp.lang.fortran | Previous | NextNext in thread | Find similar | Unroll thread


Thread

converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-23 17:16 -0500
  Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Jeff Ryman <rymanjc@outlook.com> - 2022-10-26 09:38 -0700
    Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 gah4 <gah4@u.washington.edu> - 2022-10-26 12:55 -0700
    Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-26 15:56 -0500
      Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 gah4 <gah4@u.washington.edu> - 2022-10-26 17:59 -0700
        Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-26 23:47 -0500
          Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Robin Vowels <robin.vowels@gmail.com> - 2022-10-27 00:56 -0700
            Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-29 00:05 -0500
              Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Thomas Koenig <tkoenig@netcologne.de> - 2022-10-29 14:08 +0000
                Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-29 13:59 -0500
                Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Gary Scott <garylscott@sbcglobal.net> - 2022-10-29 14:13 -0500
                Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-30 15:05 -0500
          Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 scott@slp53.sl.home (Scott Lurndal) - 2022-10-27 14:54 +0000
            Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-27 14:08 -0500
        Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Robin Vowels <robin.vowels@gmail.com> - 2022-10-27 00:53 -0700
      Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Thomas Koenig <tkoenig@netcologne.de> - 2022-10-27 18:21 +0000
        Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-27 14:00 -0500
        Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 gah4 <gah4@u.washington.edu> - 2022-10-28 02:24 -0700
        Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-29 14:40 -0500
      Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Beliavsky <beliavsky@aol.com> - 2022-10-27 12:52 -0700
  Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-26 22:26 -0700
    Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-27 14:01 -0500
  Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 gah4 <gah4@u.washington.edu> - 2022-10-27 01:51 -0700
    Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-27 14:07 -0500

csiph-web