Fortran to ANSI C
Fortran to ANSI C
(OP)
Hi,
I'm "translating" some Fortran code into ANSI C code and I'm not a Fortran developer!
Now I'm in a deadline. I've found some without meaning (for me!!!) code.
What does it means? How can I translate in ANSI C?
IF(X-TAB(NXP)) 70002, 4 ,70004
70002 NXP = NXP - 1
IF(X-TAB(NXP)) 70002, 4 ,70001
70004 IF(X-TAB(NXP+1)) 70001,70005,70006
70006 NXP = NXP + 1
4 I1 = NXP + NX
Thanks in advance.
Max
I'm "translating" some Fortran code into ANSI C code and I'm not a Fortran developer!
Now I'm in a deadline. I've found some without meaning (for me!!!) code.
What does it means? How can I translate in ANSI C?
IF(X-TAB(NXP)) 70002, 4 ,70004
70002 NXP = NXP - 1
IF(X-TAB(NXP)) 70002, 4 ,70001
70004 IF(X-TAB(NXP+1)) 70001,70005,70006
70006 NXP = NXP + 1
4 I1 = NXP + NX
Thanks in advance.
Max





RE: Fortran to ANSI C
htt
about half way down the page.
Unfortunately you have "spaghetti" code which can be very confusing to unravel !
www.Roshaz.com
RE: Fortran to ANSI C
htt
www.Roshaz.com
RE: Fortran to ANSI C
1st label if it the expression is less than zero
2nd label if it is equal to zero
3rd label if it is greater than zero
Using gotos
IF(X-TAB(NXP)) 70002, 4 ,70004
would be
if (X - TAB[NXP] < 0) goto L70002
if (X - TAB[NXP] == 0) goto L4
goto L70004
Three way jumps were invented in the days when 3 way jumps were common in assembler.
RE: Fortran to ANSI C
this code is really old (1997).
This is not the "worst" part of this "spaghetti code"!!!
I've inherit this code...It's not mine
Bye
Max
RE: Fortran to ANSI C
I think this code is much much older than 1997. This statement was obsolete before fortran 77 came out, its probably 40 years or more old !
To be fair to the original programmer, at the time it could have been the only logic option available, fortran pre-dates all other languages so there was no choice.
www.Roshaz.com
RE: Fortran to ANSI C
http://www.polyhedron.com/spag0html
to "clean" the code, then you could use f2c
http://en.wikipedia.org/wiki/F2c
www.Roshaz.com
RE: Fortran to ANSI C