Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

How to restructure a code in IVF?

atru
Beginner
817 Views

Has Intel Visual Fortran a tool to restructure a code in the staircase style?
In the case of No - is it planned?
The following is an example:

[fortran]      IF ( kon.NE.0 ) THEN
         IF ( mark(nmove).LT.0 ) THEN
            ibon = -5
         ELSE
            ibon = 5
         ENDIF
      ELSEIF ( nsq.NE.56 ) THEN
         IF ( nsq.NE.55 ) THEN
            IF ( lsq.EQ.32 ) THEN
               ibon = -5
            ELSEIF ( lsq.EQ.39 ) THEN
               ibon = -5
            ELSEIF ( lsq.EQ.35 ) THEN
               ibon = 10
            ELSEIF ( lsq.EQ.36 ) THEN
               ibon = 10
            ENDIF
         ELSEIF ( lsq.EQ.45 ) THEN
            ibon = 2
         ENDIF
      ELSEIF ( lsq.EQ.46 ) THEN
         ibon = 2
      ENDIF
      END[/fortran]

0 Kudos
4 Replies
Steven_L_Intel1
Employee
817 Views

Is this really the same as what you asked in http://software.intel.com/en-us/forums/topic/401269 ?

0 Kudos
atru
Beginner
817 Views

No, it is not. That question was about minimizing IFs. This question is about style. How to make a code more readable. Am I writing unclear?

0 Kudos
Steven_L_Intel1
Employee
817 Views

The code you showed is in an acceptable style. Are you looking for something that converts other indentation styles to this? The VS code editor will do this as you type, though it won't reformat existing code.

There are tools that do this, such as plusFORT, but all the ones I know of are commercial (not free). Intel has no plans to create such a tool. Do a Google search for "fortran code formatter" or "fortran code beautifier".

0 Kudos
atru
Beginner
817 Views
Thank you, Steve! Your answer is that I was looking for. It’s a pity that Intel has no plans to create such a tool.
0 Kudos
Reply