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


Groups > comp.lang.c > #168044 > unrolled thread

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

Started byLynn McGuire <lynnmcguire5@gmail.com>
First post2022-10-23 17:16 -0500
Last post2022-12-26 08:58 -0800
Articles 5 — 4 participants

Back to article view | Back to comp.lang.c


Contents

  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 "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 legalize+jeeves@mail.xmission.com (Richard) - 2022-10-27 20:39 +0000
      Re: converting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1 Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-12-26 08:58 -0800

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

FromLynn McGuire <lynnmcguire5@gmail.com>
Date2022-10-23 17:16 -0500
Subjectconverting a 700,000+ line Fortran 77 plus 50,000+ line C++ program to C++, part 1
Message-ID<tj4egb$u68$1@gioia.aioe.org>
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

[toc] | [next] | [standalone]


#168052

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2022-10-26 22:26 -0700
Message-ID<tjd4qp$2mqfe$1@dont-email.me>
In reply to#168044
On 10/23/2022 3:16 PM, Lynn McGuire wrote:
> 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.

Is the code modular so you can port and test just a part of it?

[toc] | [prev] | [next] | [standalone]


#168060

FromLynn McGuire <lynnmcguire5@gmail.com>
Date2022-10-27 14:01 -0500
Message-ID<tjekiq$2r0km$2@dont-email.me>
In reply to#168052
On 10/27/2022 12:26 AM, Chris M. Thomasson wrote:
> On 10/23/2022 3:16 PM, Lynn McGuire wrote:
>> 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.
> 
> Is the code modular so you can port and test just a part of it?

Somewhat.  And yes, that is what I am doing.  Port for a while and then 
test.  Port for a while and then test.  I have already completed the 
first cycle.  No showstoppers.

Lynn

[toc] | [prev] | [next] | [standalone]


#168061

Fromlegalize+jeeves@mail.xmission.com (Richard)
Date2022-10-27 20:39 +0000
Message-ID<tjeq9q$39qlf$1@news.xmission.com>
In reply to#168044
[Please do not mail me a copy of your followup]

Tim Rentsch <tr.17687@z991.linuxsc.com> spake the secret code
<86v8o9hdly.fsf@linuxsc.com> thusly:

>Lynn McGuire <lynnmcguire5@gmail.com> writes:
>
>> We are converting a 700,000+ Fortran 77 lines of code plus 50,000+ C++
>> lines of code engineering software product to C++.  [...]
>
>Which makes the posting not topical for comp.lang.c.

I'm sure you're just drowning in messages over there compared to say,
1992 usenet traffic.
-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
            The Terminals Wiki <http://terminals-wiki.org>
     The Computer Graphics Museum <http://computergraphicsmuseum.org>
  Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>

[toc] | [prev] | [next] | [standalone]


#168641

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2022-12-26 08:58 -0800
Message-ID<86a63aw18z.fsf@linuxsc.com>
In reply to#168061
legalize+jeeves@mail.xmission.com (Richard) writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> spake the secret code
> <86v8o9hdly.fsf@linuxsc.com> thusly:
>
>> Lynn McGuire <lynnmcguire5@gmail.com> writes:
>>
>>> We are converting a 700,000+ Fortran 77 lines of code plus 50,000+ C++
>>> lines of code engineering software product to C++.  [...]
>>
>> Which makes the posting not topical for comp.lang.c.
>
> I'm sure you're just drowning in messages over there compared to say,
> 1992 usenet traffic.

I'm surprised to see this kind of a posting coming from
you.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c


csiph-web