Custom Search

FORTRAN to C/C++ Converter Complete with Original Comments

Fortran to C Convert (FtoCConvert.exe)

Sample Conversion Click Here


FtoCConvert converts fixed-format Fortran sources to C. The generated C code is designed to be human-readable and suitable for further development including linking and to create DLLs. It is specifically designed to use C shared variables in place of FORTRAN COMMON variables so that it can be used to convert Real-Time Simulation Modeling source code.  Samples of original FORTRAN and converted C source are available on request.

FtoCConvert is self contained and easy to use in a command window or .bat file.

FtoCConvert has no dependencies.  Nothing else to download.

FtoCConvert is written in C but doesn't require compilation. 

FtoCConvert was developed by QuickReckoning, Inc.

Send questions and comments to the email address found here - 


There are "FORTRAN to C Converter" programs available such as FABLE or FtoC but none have been designed, nor have other authors been willing to customize their "FORTRAN to C Converter" product, for a specific target application type.

Large Real-time Simulation projects such as those required to produce or support a full scope "Nuclear Power Plant Control Room Simulator" rely on sharing data amongst hundreds of modules.  That's the opposite of what C++ is designed for, i.e., C++ keeps functions and data coupled in programming blocks referred to as objects.  But the "C programming language" allows for using either shared DLLs or memory mapped files as a mechanism to share vast amounts of pre-defined data.  

Mike Groves, a former long time engineer/consultant/designer/programmer in the Nuclear Power Plant Simulator field (1978-2000), and founder of QuickReckoning, Inc. (in 1992), has developed a utility program specifically designed to convert Real-Time Simulation model FORTRAN source code to C source code so that the models may then be compiled and linked using Microsoft Visual Studio's C compiler.  QuickReckoning, Inc. has dubbed it simply "FtoCConvert.exe".

Though many simulators previously running on legacy Gould Encore computer platforms have been ported to "WINTEL" computer platforms, the original legacy FORTRAN models have remained.  Thus, the simulator owner has had to purchase FORTRAN compilers through the years (originally "Compaq FORTRAN" and currently "Intel FORTRAN Compiler") as Microsoft Visual Studio has changed.  In addition, even though FORTRAN is rarely used today when compared to other languages including the C language the requirement is that maintenance engineers must still be knowledgeable in FORTRAN or be trained.  

Though simulator support software like executive systems and Instructor Stations along with development utility software such as QuickReckoning's own "Simease" environment or others like the "GSES SimExec" are written in C or Java, the FORTRAN simulation model development and maintenance is still required.  In regard to the legacy computer language, FORTRAN, little has changed in the past 20 years so far as Nuclear Power Plant modeling even though new versions of FORTRAN have been developed since FORTRAN 77.  

It appears as if the only reason the FORTRAN code is still around is that 1000's of lines of FORTRAN code have been written already and up until right now there has been no purely automated method to convert that FORTRAN to C.

Codes such as RELAP5 for example, were written in, and still exist only in FORTRAN.  No one has attempted to use a "FORTRAN to C Converter" program on this code.

Maybe there has never been an interest in converting this software because it has been considered too expensive to do so.  But why?  After all, much of the code used in these simulators looks just like C code - the constructs being very similar, the math libraries nearly identical.  By simply replacing some words like "IF" with "if" and "DO" with "for", much of the conversion is possible.

BUT...as with many computer programs, the last 10% of the development takes 90% of the time.  Let's not forget, after all, that FORTRAN array subscripts begin with 1 and not ZERO as C does.  Nor should we forget that the memory layout of a C matrix is different than that of a FORTRAN matrix.  If we want to use our existing Initial Condition files to "reset" our simulator, then our C code must take this matter into consideration.  The point being that there are facets of FORTRAN programming not immediately translated to C.  However, FtoCConvert.exe takes all these issues into account to deliver a "FORTRAN to C Converter" program specifically written to target Nuclear Power Plant Simulator projects.

With no desire to update our systems with the latest Intel FORTRAN offering, we undertook the challenge to write a utility that would take as input the original FORTRAN simulation subroutines and functions source files and automatically convert them to compilable C source files.  The conversion looks almost identical except with C constructs swapped in for the FORTRAN along with lots of ";" (end of line characters) and "[" "]"characters (array index characters).

To test our FtoCConvert.exe "FORTRAN to C Convert" program we converted 1000's of lines of code associated with a Nuclear Power Plant Simulator as those codes existed in 1999.  The resultant C code then compiled, and linked cleanly.  The resultant simulator then cycled without mathematical error using exactly the same Initial Conditions as those used under the FORTRAN modeling environment.

We suspect that our resulting nuclear power plant simulator, previously written with 100% of its models in FORTRAN, is the first to run by converting those FORTRAN models with C source code.  In other words, the Microsoft Visual Studio projects previously inclusive of FORTRAN source code were entirely replaced by those running the converted C source files.  

For more information about FtoCConvert.exe ("FORTRAN to C Converter") which is specifically tailored and supportive of the Nuclear Power Plant Simulation Industry contact QuickReckoning using the information found here:


Sample Conversion Click Here


Copyright 2006-2019 QuickReckoning.Com
Last modified: April 17, 2019