Hi all,
I asked this question on "Code Modernization" forum, but I did not received any answer hence I created a new thread here on this forum.
The first question:
I found medium size ~10K loc of FORTRAN 77 source code which describes complete computational flight dynamics simulation. I would like to convert this code which exists only in printed form to C++ version in order to use it in my missile simulation open source project.
After browsing through the sources I realized that, subroutines pass information between themselves with the help of COMMON blocks only. I would like to ask you what will be the best approach for the code conversion? My biggest problem is related to massive usage of COMMON blocks which will imply usage of dedicated namespace to host those global variables extracted from the COMMON blocks. The other option more secure is to put all global variables from the common block to anonymous namespace which is visible only from the single translation unit, but this approach will force me to write all classes in single file.
The second question:
This question is related to code conversion from FORTRAN 90 repository to C++.
I am thinking about 3 approaches:
1) Translation of FORTRAN 90 module to single C++ translation unit in its own namespace with FORTRAN subroutines converted to C++ global(namespace functions) and module globals which can be represented as a members of anonymous namespace.
2) Trying to create simple OOP design by for example converting FORTRAN subroutine into simple C++ class where subroutine's output argument(s) can be represented as class member variable(s). One of the problem will be a large number of some subroutine's arguments passed to it, additional problem will be issue of global variables representation in C++, but I think this can be handled by using named namespace solely dedicated to globals.
3) Use translation tool like f2c and manually convert from C version to C++, which btw I already did while porting NRLMSISE_00 atmosphere model to C++.
Thank you in advance.