Board index » delphi » Fortran-Pascal interaction

Fortran-Pascal interaction

I've found a set of routines (>1000 lines) in (standard) fortran that i'd
like to use in my Pascal code.

I need help on either:

automatic "translation" of Fortran to Pascal code, or
creating and calling Fortan libraries from Pascal

thanks,

Jaime Bustos j...@Lehigh.Edu

 

Re:Fortran-Pascal interaction


Quote
news wrote:
> I've found a set of routines (>1000 lines) in (standard) fortran that
> i'd
> like to use in my Pascal code.

> I need help on either:

> automatic "translation" of Fortran to Pascal code, or
> creating and calling Fortan libraries from Pascal

     Unless you are fortunate enough to have both a Pascal and Fortran
compiler (and run-time library) for the same machine and OS, the
"library" method is probably not going to work.

     If you were so fortunate, then here's what you'd probably need to
do.  First, I'm assuming that the Fortran routines exist as source code,
and are all subroutines (or functions).  I also assume that you intend
for the calling routine to be Pascal.  I further assume your Pascal
compiler can specify externally-compiled routines via a declaration
something like "external", but designed for the Fortran calling
convention.

     As long as there is only one set of i/o routines, preferably those
in Pascal, the problem is not too difficult.  So the first thing to do
is look through the Fortran code and remove any read, write, and format
statements.  If the Fortran routines need data, you'll want to obtain
the data in Pascal and pass it into the routine.

     Next, compile your Fortran code.  Compile your Pascal code.  Link
them, specifying the Fortran Run Time Library in whatever manner your
Pascal linker requires for external libraries.

     Now, if that does not work, you can still get the benefit of the
Fortran code.  While I know of no "automatic" procedure for translating
Fortran to Pascal, it is not very difficult to do so "by hand".  If you
do, I would suggest that you rename most of the variables to get away
from the Fortran "I,J,K" rules for distinguishing integers and reals.
I'd also suggest identifying the Fortran "tricks" for processing
character data (like stuffing them into Logical*4 variables) and
recoding them in "straight" Pascal.

     If there are logic constructs in the Fortran code that you do not
understand (such as,
perhaps, the Arithmetic IF, or Computed GoTo), post a small code sample
here and ask.

Bob Schor
Pascal Enthusiast
[Haven't used Fortran since I discovered Pascal ...]

Re:Fortran-Pascal interaction


In article <7l877t$...@fidoii.cc.Lehigh.EDU>,
  "news" <j...@Lehigh.edu> wrote:

Quote
> I've found a set of routines (>1000 lines) in (standard) fortran that
i'd
> like to use in my Pascal code.

> I need help on either:

> automatic "translation" of Fortran to Pascal code, or

Might be available, and for these two languages the result may
actually be acceptable, nevertheless, I've never heard of anything.

BTW, a few years ago I had to translate Fortran into PL/I, it turned out
to be quite simple, and I cannot imagine that Fortran to Pascal will be
much more difficult.

Quote
> creating and calling Fortan libraries from Pascal

Point your browser at a suitable filesearcher and look for the file
tpfort18.zip. (Written by Duncan Murdoch)

NB, if is the source for Numerical Recipies, look for NRPAS13.ZIP...

Note to Timo S: It used to be on Garbo, but seems to have gone!

HTH,

Robert
--
Robert AH Prins
prin...@willis.com

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Re:Fortran-Pascal interaction


In article <7lb33t$nm...@nnrp1.deja.com>,
Robert AH Prins  <prin...@williscorroon.com> wrote:

:tpfort18.zip. (Written by Duncan Murdoch)

:NB, if is the source for Numerical Recipies, look for NRPAS13.ZIP...

:Note to Timo S: It used to be on Garbo, but seems to have gone!

My Dear Net-Friend Robert,

Just maybe you are looking in the wrong directory. These are the
Garbo references:

 303573 May 2 1991 ftp://garbo.uwasa.fi/pc/turbopas/nrpas13.zip
 nrpas13.zip Numerical Recipes Pascal shareware version, 303K!

 28394 Mar 8 1992 ftp://garbo.uwasa.fi/pc/tur{*word*77}j/tpfort18.zip
 tpfort18.zip Link TP 5.5+ with MS Fortran 5.x, w/opro.inc, D.Murdoch

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland
Digital photos collection at http://www.uwasa.fi/ktt/lasktoim/photo/

Re:Fortran-Pascal interaction


In article <7lc5l5$...@loisto.uwasa.fi>,
  t...@UWasa.Fi (Timo Salmi) wrote:

Quote
> In article <7lb33t$nm...@nnrp1.deja.com>,
> Robert AH Prins  <prin...@williscorroon.com> wrote:

> :tpfort18.zip. (Written by Duncan Murdoch)

> :NB, if is the source for Numerical Recipies, look for NRPAS13.ZIP...

> :Note to Timo S: It used to be on Garbo, but seems to have gone!

> My Dear Net-Friend Robert,

> Just maybe you are looking in the wrong directory. These are the
> Garbo references:

>  303573 May 2 1991 ftp://garbo.uwasa.fi/pc/turbopas/nrpas13.zip
>  nrpas13.zip Numerical Recipes Pascal shareware version, 303K!

Sorry, the note about nrpas13 should have appeared after the note about
not being able to get tpfort18.zip.

Quote
>  28394 Mar 8 1992 ftp://garbo.uwasa.fi/pc/tur{*word*77}j/tpfort18.zip
>  tpfort18.zip Link TP 5.5+ with MS Fortran 5.x, w/opro.inc, D.Murdoch

I tried this directory several times yesterday, but every time I got a
"Document contains no text" error, which led me to the erroneous
statement, sorry.

Robert
--
Robert AH Prins
prin...@willis.com

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Re:Fortran-Pascal interaction


Quote
Bob Schor wrote:
> Bob Schor
> Pascal Enthusiast
> [Haven't used Fortran since I discovered Pascal ...]

  A wise man : )

Re:Fortran-Pascal interaction


Quote
news <j...@Lehigh.edu> wrote:
> creating and calling Fortan libraries from Pascal

GNU Fortran and GNU Pascal are compatible in this way.

Since the current version of GNU Pascal is mostly compatible to
Borland Pascal 7.0 you might want to try it out. See:

    http://home.pages.de/~GNU-Pascal/

Hope this helps,

    Peter

--
Peter Gerwinski, Essen, Germany, http://home.pages.de/~Peter.Gerwinski/
Maintainer GNU Pascal - http://home.pages.de/~GNU-Pascal/ - gpc-19990118
  PGP key on request - 6C 94 45 BE 28 A4 96 - 0E CC E9 12 47 25 82 75
*** Vote against SPAM! ********* http://www.politik-digital.de/spam/ ***

Other Threads