×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Fortran to ANSI C
2

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

RE: Fortran to ANSI C

It is an arithmetic if

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

(OP)
Thaks johnhors and xwb,
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 smile

Bye

Max

RE: Fortran to ANSI C

No, I wouldn't own up to it either!

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

It may have been written for compatibility with Fortran II.  I worked on several projects where the code had to compile on Fortran II, Fortran IV and Fortran 77 and the only option was to use arithmetic ifs.
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close