Fortran Dev C%2b%2b

  1. Fortran Dev C 2b 2b Tutorial

EQUIVALENCE and COMMON variants

See the OpenSolaris wiki page Installing C, Fortran Development Tools for more information. On Linux platforms, you can use GNU tools or Sun Studio tools. NetBeans IDE has been tested with the following compilers and tools.

Large Fortran programs tend to make use of EQUIVALENCE and 'commonvariants'. A simple example of a common variant is:

  • A translator from Fortran90/Fortran77(ISO/IEC 1539:1991) to C. Fortran is an efficient tool in scientific calculation. However sometimes translating old fortran codes to C will enable more programming abstraction, better GUI framework support, higher performance IDE and easier interaction.
  • FORTRAN stores arrays in column-major order, i.e. The array is stored in memory as the first column, followed by the second column, followed by the third column, etc. C stores arrays in row-major order, i.e. The first row, followed by the second row, etc. Change your code to access the array row-by-row instead of column-by-column.

fable is designed to handle all legal combinations of commonvariants and EQUIVALENCE, but the generated C++ code iscluttered quite badly with mbr<> and bind<> statements(e.g. [Fortran][C++]). If the generated C++ code ismeant to be a basis for future development, it is a good ideato consider modifying the Fortran code before finalizing theconversion. Sometimes common variants are accidental and can easily beavoided. To help in detecting such cases, fable.cout writes a filefable_cout_common_report (example)which shows the differences between the variants.

The use of Fortran EQUIVALENCE also leads to clutter in thegenerated C++ code. For equivalences involving common variables,fable_cout_common_report shows a list of the problem cases, sortedby volume of the corresponding generated code. If it is known that theequivalences do not affect the size of a common block, the fable.cout--common-equivalence-simple option can be used to direct fable togenerate much less cluttered C++ code for handling the equivalences.(Possible but not implemented: automatic detection of simpleequivalences.)

Download

EQUIVALENCE and COMMON variants

Large Fortran programs tend to make use of EQUIVALENCE and 'commonvariants'. A simple example of a common variant is:

fable is designed to handle all legal combinations of commonvariants and EQUIVALENCE, but the generated C++ code iscluttered quite badly with mbr<> and bind<> statements(e.g. [Fortran][C++]). If the generated C++ code ismeant to be a basis for future development, it is a good ideato consider modifying the Fortran code before finalizing theconversion. Sometimes common variants are accidental and can easily beavoided. To help in detecting such cases, fable.cout writes a filefable_cout_common_report (example)which shows the differences between the variants.

Fortran Dev C 2b 2b Tutorial

The use of Fortran EQUIVALENCE also leads to clutter in thegenerated C++ code. For equivalences involving common variables,fable_cout_common_report shows a list of the problem cases, sortedby volume of the corresponding generated code. If it is known that theequivalences do not affect the size of a common block, the fable.cout--common-equivalence-simple option can be used to direct fable togenerate much less cluttered C++ code for handling the equivalences.(Possible but not implemented: automatic detection of simpleequivalences.)

Comments are closed.