[Geany] Fortran fixed/free format

Konstantinos Poulios poulios.konstantinos at xxxxx
Sat Mar 15 10:53:19 UTC 2008


hi!!

I have recently tried geany and I am really surprised of the work done
in this "small" IDE. It's definitely the nicest / most intuitive IDE I
have ever tried.

And now about the problem. I use to program a lot in fortran.
Unfortunately I found out that geany doesn't distinguish between fix and
free fortran format. After a short look into the scintilla part in geany
sources I realized that only the free format lexer of sintilla is
currently linked and used in geany (lmfortran and not lmf77 of
LexerFortran.cxx).

But that's not really the problem. The problem is that the chosen
scintilla free format lexer seems to apply on everything between column
7 an column 72, which is a fix format convention. That means the source
code is truncated between the 7th and 72th column, like it was fixed
format and then highlighting is applied using the lmfortran scintilla
lexer like we had fortran free format source code. The same problem is
related to folding (because of truncating everything before the 7nth
column).

As result of this inconsistency neither fortran fix format nor fortran
free format is being highlighted and folded correctly.

About the solution.

At first one should repair the fortran free format by not truncating the
code lines. Or rather truncating them from the first column up to the
column defined in geany as maximum line length.
In the menu
Document->Set filetype -> Fortran Source File (F77)
the specification (F77) has also to be omitted (actually this statement
is anyway not 100% true).
As Compiler and Linker the "g77" option in "filetype.fortran" should be
replaced by "g95".

Most users (me too) would be happy with only this modification. Anyway
most fix format fortran code was written in a period where not only text
highlighting but even color monitors were scientific fiction.

In a second step, in order to also repair the fix format representation
one should  define two distinct filetypes one for the fix format and the
file extensions *.f, *.for, *.ftn and *.f77 and one for the free format
and the file extensions *.f90,*f95,*.f2k.
For the fix format filetype the lexer module lmf77 of LexerFortran.cxx
should be linked instead of lmfortran.
The g77 compiler should be used for compiling and linking.


SciTE currently treats fixed and free fortran format correctly. It would
be useful to compare.

For the implementation of any solution for the problem mentioned here I
am always willing to help. I could test a solution or I could work on a
solution if I had some advise where to begin and what is your opinion
about my suggestions.

Best Regards

Kostas




More information about the Users mailing list