[Lazarus] Converting Fortran to FPC?
Bo Berglund
bo.berglund at gmail.com
Fri Oct 8 07:27:12 CEST 2010
On Fri, 8 Oct 2010 01:56:10 +0300, "Juha Manninen (gmail)"
<juha.manninen62 at gmail.com> wrote:
>Apparently the automatic conversion doesn't work. You must do it manually.
>It is not only a bad thing because then you also must understand the code
>while converting it.
Yeah, yet another language to master...
I dived into Java for this project back in May, but it was so tedious
that I slowed down and then I realized that Lazarus might fit the bill
instead.
And now the scope has widened when I realized that all of our Delphi
code is candidate for conversion to Lazarus and hence Linux. :-)
This in turn has popped the Fortran conversion issue.
I already had a look at manual conversion of a few functions and tey
look fairly simple really, mostly a lot of array manipulations in do
loops.
>
>Learn to read it. It can't be very difficult. For example C++ is a complicated
>and difficult language but Fortran is an old and primitive language. You should
>be able to learn the syntax quickly. Your code is arithmetic calculation which
>should map to Pascal's math operators and functions nicely.
>Googling for "Fortran tutorial" gives for example:
> http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/fortran.html
>which looks good.
Thanks for the link, I'll have a look. I also found this myself:
http://www.idris.fr/data/cours/lang/fortran/f90/F77.html
It deals with Fortran77 but also mentions later constructs. Anyway by
looking here I could understand how the conversion code works better.
Apparently Fortran77 is column oriented such that certain control data
are supposed to be located in fixed positions on each line!
That never occurred to me. It is a leftover from the punchcard times
where each program line was on an 80 char punchcard. Ouch!
>After you understood what the functions do and converted them, then create a
>test program that feeds different input to every function and compares their
>output with the original Fortran functions' output. You can even create a
>test-version of the real program which calls those functions, by adding
>another call for the converted function and then comparing the results.
>
Exactly!
But there are a lot of files, about 30 in total.
Just work though.
--
Bo Berglund
Developer in Sweden
More information about the Lazarus
mailing list