[f2py] [SciPy-dev] Compiling F77, F90 free, and F90 fixed format codes in scipy_distutils

Roman Bertle bertle@kph.tuwien.ac.at
Wed, 11 Dec 2002 20:50:51 +0100


Pearu Peterson wrote:
>Basically, the key question is how to decide if a Fortran source file
>contains Fortran 77, Fortran 90 free format, or Fortran 90 fixed format
>code?

The vim syntax file fortran.vim
(http://www.unb.ca/chem/ajit/syntax/fortran.vim) searches in f90 and f95
files for free fixed form comments in the first 15 lines. The regex is:
      if b:test[0] !~ '[Cc*!#]' && b:test !~ '^ \+[!#]' && b:test =~ '[^ 0-9\t]'
where b:test is the string containing a line of source code. If the line
is matched, free form is assumed.

But this method is not perfect, since the '!' might be always in the
first column for the first 15 lines, even for free form.

Roman