<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Thanks to Arjen and mecej4.  in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129946#M134017</link>
    <description>&lt;P&gt;Thanks to Arjen and mecej4.&amp;nbsp; I'll need to think about which method makes most sense in this case.&amp;nbsp; It looks as if the compiler directives (which I was unaware of) provide most flexibility.&lt;/P&gt;</description>
    <pubDate>Sat, 17 Jun 2017 01:18:44 GMT</pubDate>
    <dc:creator>gib</dc:creator>
    <dc:date>2017-06-17T01:18:44Z</dc:date>
    <item>
      <title>Combining F77 and F90 code</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129943#M134014</link>
      <description>&lt;P&gt;I have some old F77 code (nleq1, horrible-looking but very effective) that I am using in F90 programs.&amp;nbsp; Currently I'm keeping the files separate, with a F90 file that defines a module, and several F77 files (*.f), one of which USEs the module.&amp;nbsp; It's all a bit messy.&amp;nbsp; I'm wondering if there is a way to collect the *.f files together in a module, and/or can a F90 file contain both free-form and fixed-form procedures.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 04:01:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129943#M134014</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2017-06-15T04:01:19Z</dc:date>
    </item>
    <item>
      <title>Well, the simplest way to</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129944#M134015</link>
      <description>&lt;P&gt;Well, the simplest way to achieve that is to use the fixed-form altogether and replace the END statement by END SUBROUTINE or END FUNCTION. Then you can join the files into a module:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;      module my_old_ugly_f77_code
      contains
      ... contents of file 1
      ... contents of file 2
      ...
      end module&lt;/PRE&gt;

&lt;P&gt;It is possible to format code in such a way that it is acceptable as both fixed-form and free-form, modulo a few nasty aspects of fixed-form (notably the fact that spaces are not really significant - I 20 = 1 is the same as I20 = 1), but why bother? Fixed-form is still acceptable as a way to write Fortran 90 style code. And it makes life quite a bit easier.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 06:49:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129944#M134015</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2017-06-15T06:49:33Z</dc:date>
    </item>
    <item>
      <title>Giv, consider whether the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129945#M134016</link>
      <description>&lt;P&gt;Gib, consider whether the FREEFORM and NOFREEFORM compiler directives will help. These directives allow mixing blocks of free form &amp;nbsp;code and blocks of fixed form code in the same source file.&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;https://software.intel.com/en-us/node/692821#38A9609E-0460-4243-A0F2-C47474F014D4&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 09:39:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129945#M134016</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2017-06-15T09:39:00Z</dc:date>
    </item>
    <item>
      <title>Thanks to Arjen and mecej4. </title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129946#M134017</link>
      <description>&lt;P&gt;Thanks to Arjen and mecej4.&amp;nbsp; I'll need to think about which method makes most sense in this case.&amp;nbsp; It looks as if the compiler directives (which I was unaware of) provide most flexibility.&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2017 01:18:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129946#M134017</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2017-06-17T01:18:44Z</dc:date>
    </item>
    <item>
      <title>Using the NOFREEFORM</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129947#M134018</link>
      <description>&lt;P&gt;Using the NOFREEFORM directive I put all the nleq1 files into a module, replacing all the EXTERNAL statements, declaring many undeclared variables, fixing END statements etc.&amp;nbsp; I'm now handling the call-back with procedure(func), another capability that I just learned of.&amp;nbsp; The result is much neater, and I'm very pleased.&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 04:33:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129947#M134018</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2017-06-19T04:33:35Z</dc:date>
    </item>
    <item>
      <title>One of my students is using</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129948#M134019</link>
      <description>&lt;P&gt;One of my students is using gfortran.&amp;nbsp; Unfortunately the !DIR$ directives do not appear to be supported by gfortran :(&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 00:13:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129948#M134019</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2017-06-20T00:13:20Z</dc:date>
    </item>
    <item>
      <title>Yes, that is a risk with any</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129949#M134020</link>
      <description>&lt;P&gt;Yes, that is a risk with any non-standard features. I do not know if gfortran has an equivalent feature, but it may be worth trying to find out. The alternative is to separate the fixed-form and free-form parts into separate files. Fixed-form still allows all the benefits of modern Fortran. the only thing you cannot do is make a single module, although you can combine modules into a single one (joining the interfaces, not the modules as such)&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 06:43:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129949#M134020</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2017-06-20T06:43:43Z</dc:date>
    </item>
    <item>
      <title>You may try the Silverfrost</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129950#M134021</link>
      <description>&lt;P&gt;You may try the Silverfrost FTN95 compiler's /CONVERT option and do a one-time conversion from fixed source form to free form, see&amp;nbsp;http://www.silverfrost.com/ftn95-help/options/quick_reference.aspx . There are tools such as SPAG that also do code conversions.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 09:37:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129950#M134021</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2017-06-20T09:37:00Z</dc:date>
    </item>
    <item>
      <title>Quote:gib wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129951#M134022</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;gib wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;One of my students is using gfortran.&amp;nbsp; Unfortunately the !DIR$ directives do not appear to be supported by gfortran :(&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;@gib,&lt;/P&gt;

&lt;P&gt;Students should all be trained to use SUBMODULEs, PRONTO! &amp;nbsp; And to use standard language features as much as possible and consider minimal use of compiler directives and options.&lt;/P&gt;

&lt;P&gt;See if the fixed-form code can be wrapped in SUBMODULEs and be provided with the MODULE prefix, as follows:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module collect_m

   interface

      module subroutine fugly1( a1, a2, ..)
      ! Interface to fixed-form procedure fugly1

         &amp;lt;type&amp;gt; a1
         &amp;lt;type&amp;gt; a2

      end subroutine fugly1

      module function fugly2( b1, b2, ..)
      ! Interface to fixed-form procedure fugly2

         &amp;lt;type&amp;gt; b1
         &amp;lt;type&amp;gt; a2

      end function fugly2

   end interface

contains

   subroutine sub1( .. )

      ..

   end subroutine

   function f1( .. )

      ..

   end function f1

end module
&lt;/PRE&gt;

&lt;PRE class="brush:fortran;"&gt;      SUBMODULE(COLLECT_M) FUGLY1_SM
      
         IMPLICIT NONE
      
      CONTAINS
      
         MODULE SUBROUTINE FUGLY1(A1, A2, ..)
      
            &amp;lt;TYPE&amp;gt; A1
            &amp;lt;TYPE&amp;gt; A2

            ..

            RETURN
      
         END SUBROUTINE FUGLY1
      
      END SUBMODULE FUGLY1_SM
&lt;/PRE&gt;

&lt;PRE class="brush:fortran;"&gt;      SUBMODULE(COLLECT_M) FUGLY2_SM
      
         IMPLICIT NONE
      
      CONTAINS
      
         MODULE FUNCTION FUGLY2(B1, B2, ..)
      
            &amp;lt;TYPE&amp;gt; B1
            &amp;lt;TYPE&amp;gt; B2

            ..

            RETURN
      
         END SUBROUTINE FUGLY2
      
      END SUBMODULE FUGLY2_SM
&lt;/PRE&gt;

&lt;P&gt;So note the fixed-form code represented by FUGLY1 and FUGLY2 above are pretty retained as-is, all that is done is standard attributes to wrap such code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 13:00:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129951#M134022</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2017-06-20T13:00:05Z</dc:date>
    </item>
    <item>
      <title>That's not a very appealing</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129952#M134023</link>
      <description>&lt;P&gt;That's not a very appealing solution, FortranFan, because there are so many subroutines and functions.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 02:31:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129952#M134023</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2017-06-21T02:31:45Z</dc:date>
    </item>
    <item>
      <title>Thanks mecej4, the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129953#M134024</link>
      <description>&lt;P&gt;Thanks mecej4, the Silverfrost FTN95 compiler with the /CONVERT option looks interesting - free for personal use.&amp;nbsp; I might give it a try.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 02:38:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129953#M134024</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2017-06-21T02:38:00Z</dc:date>
    </item>
    <item>
      <title>On Silverfrost /CONVERT - I</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129954#M134025</link>
      <description>&lt;P&gt;On Silverfrost /CONVERT - I installed it and ran the conversion on a fixed-form .f file.&amp;nbsp; The result is if anything even uglier than the original.&amp;nbsp; Interestingly, the .f file has this line&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PARAMETER (ZERO = 0.0 D0)&lt;/P&gt;

&lt;P&gt;which is accepted by ifort.&amp;nbsp; The same line appears in the converted free-form .f90 file, but now in ifort the space creates an error.&amp;nbsp; When the space is removed the file compiles, so that's success.&amp;nbsp; Obviously a change between f77 and f90.&amp;nbsp; It still needs some attention before being packaged in a module (END statements need to be completed), but that is relatively minor.&amp;nbsp; It also strips out all the comments, which is not very friendly.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 03:07:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129954#M134025</guid>
      <dc:creator>gib</dc:creator>
      <dc:date>2017-06-21T03:07:05Z</dc:date>
    </item>
    <item>
      <title>Note there are other such</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129955#M134026</link>
      <description>&lt;P&gt;Note there are other such programs available (Alan Miller and Michael Metcalfe have written and published such programs for instance). Whether they produce something in the style you want will depend.&lt;/P&gt;

&lt;P&gt;As for PARAMETER (ZERO = 0.0 D0) not being accepted in free-form: that is one of the few incompatibilities between the two source forms. In fixed form spaces essentially have no particular meaning, in free form they do.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 09:06:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129955#M134026</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2017-06-21T09:06:52Z</dc:date>
    </item>
    <item>
      <title>Quote:gib wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129956#M134027</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;gib wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;That's not a very appealing solution, FortranFan, because there are so many subroutines and functions.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Suit yourself, but anyone else interested in refactoring their code will note:&lt;/P&gt;

&lt;OL&gt;
	&lt;LI&gt;the compiler option /gen-interfaces (https://software.intel.com/en-us/fortran-compiler-18.0-developer-guide-and-reference-gen-interfaces) can be used to achieve a decent initial state of interfaces of all the existing legacy code that is usually in fixed-form source format and without explicit interfaces.&lt;/LI&gt;
	&lt;LI&gt;Then one can use any of the scripting options (e.g., Perl) to quickly absorb the interfaces into a module and to wrap the legacy code in SUBMODULEs. &amp;nbsp;Note&amp;nbsp;with SUBMODULEs one does not materially need to change the legacy code in any way; it can even remain in fixed-format source form which is also supported by the current Fortran standard. &amp;nbsp;One only prepends and appends 'stuff' to the source.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Wed, 21 Jun 2017 13:10:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129956#M134027</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2017-06-21T13:10:54Z</dc:date>
    </item>
    <item>
      <title>I found gen interfaced of</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129957#M134028</link>
      <description>I found gen interfaced of little use to me as it resolved all data kinds e.g. Integer(handle) becomes integer(4) in the source so 32 and 64bitness change will give an incorrect interface as will also happen if you change the value of a kind parameter. I have not checked the latest compiler for this. In the end i wrote my own source parser to create interfaces for my code as this was the fastest route I found.</description>
      <pubDate>Wed, 21 Jun 2017 16:29:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Combining-F77-and-F90-code/m-p/1129957#M134028</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2017-06-21T16:29:43Z</dc:date>
    </item>
  </channel>
</rss>

