[Novalug] Fortran to Perl - help (don't laugh)
william at trilug.org
Thu Dec 9 16:54:07 EST 2010
from my fortran expert, the following observations:
Well, she is pretty close. Have not seen the ; used before, probably a
later version of FTN, but, yes, it is effectively a line end/line feed.
I'd re-write the FTN code as follows:
do i=1, n
if (pere(i).gt.n) then
if (mere(i).gt.n) then
with the additional comments:
1. change stop; to stop.
2. executable FTN statements must appear between col 7 and 72 inclusive.
3. one executable statement per line
4. indentation is pretty print only, the FTN compiler does not care.
On Thu, 9 Dec 2010, Bonnie Dalzell wrote:
> I finally found some source code for calculating coefficients of
> inbreeding. It is from a freely distributed package called Pedig and I
> finally found where it could be downloaded. Previously all the links I
> found were stale and expired.
> Problem is that I do not currently do Fortran and I am not excited
> about learning it.
> Anyway I also found F2perl which is a utility that helps to generate
> perl code from fortran code. it seems pretty helpful and gives useful
> error messages. However some of the error messages need some one who
> understands fortran to help me make sense of them.
> One error I cannot figure out involves two lines of Fortran within this
> do loop:
> do i=1, n
> if (pere(i).gt.n) then ; print 8513; stop; end if
> if (mere(i).gt.n) then ; print 8514; stop; end if
> end do
> F2perl does not know what the semi-colons mean.
> I tried to google Fortran use of ; with no luck.
> Here is the F2Perl error message:
> f2perl par3.f
> Error: unknown statement type: then ; print 8513; stop; end if
> Error: unknown statement type: then ; print 8514; stop; end if
> Is the ; a line ending character as in some other languages so that this
> loop could also be something like:
> do i=1, n
> if (pere(i).gt.n) then
> print 8513
> end if
> if (mere(i).gt.n) then
> print 8514
> end if
> end do
> I did read enough in some intro to Fortran articles to see that column
> placement is important in Fortran so I am not sure how the loops
> should be indented if the lines are made separately.
> The original author of the program is French so this loop is looking for
> father (pere) and mother (mere).
> Thanks again for help.
> Really really happy to be back on the east coast after 3 weeks in rural SW
> Bonnie Dalzell, MA
> mail:5100 Hydes Rd PO Box 60, Hydes,MD,USA 21082-0060|EMAIL:bdalzell at qis.net
> Freelance anatomist, vertebrate paleontologist, writer, illustrator, dog
> breeder, computer nerd & iconoclast... Borzoi info at www.borzois.com.
> HOME www.batw.net ART bdalzellart.batw.net BUSINESS www.boardingatwedge.com
> Novalug mailing list
> Novalug at calypso.tux.org
More information about the Novalug