Bo Berglund wrote:
On Thu, 07 Oct 2010 02:22:55 +0000, Mark Morgan Lloyd
<[email protected]> wrote:
Bo Berglund wrote:
On Wed, 06 Oct 2010 23:34:29 +0200, Bo Berglund
<[email protected]> wrote:
I found this converter by googling (offered on several websites, but
basically the same everywhere):
http://sourceforge.net/projects/fortran2pascal/
but unfortunately it only handles Fortran77 code, whereas our code is
Fortran90 syntax.
Tried it on one of the files but it created unusable pascal code.
So is there something for Fortran90 or later?
What sort of unusable? Does it document what target compiler it expects,
i.e. GNU Pascal?
Well it produces syntactically illegal pascal code...
Here a short example of the start of a subroutine (newsreader has
wrapped the code, long lines are ending with &) :
------ Fortran code -------
subroutine StiffnessFE(NodeX, NodeY, Conductivity, ReducedStiff,
abscix, &
iElemX, iElemY, LocalNodes, CenterNodeX,
CenterNodeY, &
ElemArea)
use GlobalForw
implicit none
integer, intent(in) :: iElemX, iElemY
real(Rkind), intent(in), dimension(1:gNumNodes) :: NodeX, NodeY
real(Rkind), intent(in), dimension(1:gNumElem) :: Conductivity
----- Translates to this ------------
procedure StiffnessFE(var NodeX, NodeY, Conductivity, ReducedStiff,
abscix, &;
begin
iElemX, iElemY, LocalNodes, CenterNodeX, CenterNodeY, &;
ElemArea);
use GlobalForw;
, intent: array[in] of .... iElemX integer;
real(Rkind), intent(in), dimension(1:gNumNodes) :: NodeX, NodeY;
real(Rkind), intent(in), dimension(1:gNumElem) :: Conductivity;
------------------
You don't have to be an expert to see that this will not compile at
all. The rest of the file looks much the same.
If I'm reading that correctly & is being used as a continuation flag, in
much the same way that \ is used in C or shell script. You might find
that if you filtered that out (I tend to use Perl for that sort of job)
before trying to run it through the converter that the output will make
more sense.
You also need to determine what dialect of Pascal the output is: you
could find that you're being given something obscure like Pascal-SC.
A few seconds Googling comes up with
http://community.freepascal.org:10000/bboards/message?message_id=145352&forum_id=24105
which points at a Windows-based converter, still '77 though. There's
also apparently a FORTRAN to Ada converter f2a which could be a useful
intermediary, however I can't so far see a URL (and I'm not putting much
time into this since /I/ don't have any FORTRAN to convert :-)
[Slightly later] http://archive.adaic.com/tools/for2ada95/f2a.pl but the
description indicates that it's strictly line-by-line.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus