FRUIT is available at http://sourceforge.net/projects/fortranxunit.
A Python interface to FRUIT is available at https://github.com/acroucher/FRUITPy.
You can edit this website using the Edit Page link at the bottom of each page. Feel free to use the Sandbox to experiment. The HowTo contains more information on getting started. For questions, see Fortran Wiki discussion.
.f03 are used for modern, free-form source code conforming to the Fortran 90, Fortran 95, and Fortran 2003 standards. Some choose to use
.f90 to denote any free-form source code, for example, including Fortran 2003 code.
Another convention, used by the GFortran compiler, is to use upper-case extensions to denote files which should be processed by the C preprocessor.
arjen (7 may 2009) Note that the Fortran standard itself does not define any extension, it does not even prescribe the use of files on disk to represent the source code. This may seem odd, but there are good reasons for this: a system might use a database of some sort to store all information in, so if the standard prescribed files on disk as the medium, it would exclude such systems.
What’s more, the concept of a file extension is ubiquitous on Windows platforms, but UNIX/Linux do not attach any special meaning to the last bit of a file name.
That said, the common conventions are:
Some recommend not using the
.f03 file extensions (not to mention
.f15). Not only are these extension not recognized by all compilers, but Fortran 95 or Fortran 2003 code can be written as fixed-form source (it’s still part of the standard). Use
.f90 to indicate free-form source code. See: Source Form Just Wants to be Free
There are many editors that support Fortran syntax highlighting.
(TODO expand this list)
An enhanced Vim syntax file that includes Fortran 2003 keywords is available here:
The following can be added to
$HOME/.vimrc. It maps
<shift>-F to toggle between fixed and free format Fortran source. In case it is hit by mistake,
<ctrl>-F is mapped to re-detect the syntax.
nmap <S-F> :set syntax=fortran<CR>:let b:fortran_fixed_source=!b:fortran_fixed_source<CR>:set syntax=text<CR>:set syntax=fortran<CR> nmap <C-F> :filetype detect<CR>
When editing Fortran on Linux I use gedit which is adequate. When editing Fortran on Microsoft Windows (TM) there are lots of editors available, none of them (in my experience) really good enough. Here are my thoughts on a few that I’ve used more than a few times:
Code::Blocks IDE for Fortran (http://darmar.vgtu.lt/): Recommended! Originally developed for C++, this advanced IDE has many features of eclipse and supports most features of Fortran 2003 and 2008. The environment is quite user friendly and easy to use. It is one of the few true IDEs for Fortran. I think the support of the Fortran community will help this IDE to become a very powerful general purpose and fast Fortran programming tool.
Jedit - written in Java - when opening more than one file this has no tabs but a drop-down list at the top, which I find less convenient. But it has good Fortran90 aware syntax highlighting (I had to make a small change to the configuration file to prevent every line starting with C being treated as a comment, but that was not difficult). But the print system is a Java-special, not using the regular Windows print menu, so you can’t alter your printer defaults, e.g. to print 2 pages per sheet of paper. This is an annoyance.
Gedit - there is a windows binary to download which worked with no trouble, but there is no manual and no help (missing file). The syntax highlighting did work for Fortran90, but it did not understand the .f90 or .f95 file extension, and had to be set each time, which was very tedious. I could not find the relevant file on the website, nor when I untarred a regular gedit distribution. Looking at the help on a Linux box there did not seem to be a way of associating file extensions with language highlighting.
Notepad++ - has tabbed browsing, and uses regular Windows printing, but the syntax highlighting was set for Fortran77, and was really not useful. After being annoyed by it for some time, I found it best to disable the highlighting entirely. In principle one could define one’s own Fortran90 syntax file, but I couldn’t be bothered to do this. Apart from this it’s a fairly good editor.
Notetab light - the free version of a commercial editor notetab. This is another adequate editor: regular Windows printing, no tabbed file opening, no syntax highlighting. It seems to have no particular features that at least one of the others has.
Geany(http://www.geany.org/): This is a free open source editor with many capabilities which also supports programming in Fortran. There are several plugins to deal with project management, debugging etc. The editor lets you for extensive customization for a programming language and even adding new one! It is available for both Windows and Linux.
Simply Fortran(http://simplyfortran.com/): lightweight IDE for MS Windows and compatible operating systems. Made with GNU Fortran in mind, but configurable with most compilers, it comes with an intergrated development environment, a graphical debugger, and a collection of other development accessories. In early stages of development as of now, has some bugs, but the author’s working on them.
Programmer’s Notepad - A general source code editor for MS Windows. It can be configured to build Fortran files with arbitrary command lines, or to invoke make in a particular directory. Like many editors, it is C-centric, but the Fortran support is adequate.
Absoft Pro Fortran - A IDE developed by Absoft specially for Fortran. http://www.absoft.com/
Chin, L. S., D. J. Worth and C. Greenough (2006). Thoughts on using the Features of Fortran 95. Software Engineering Group Notes no. SEG-N-003.
Gray, M. G. and R. M. Roberts (1997). Object-based programming in Fortran 90. Computers in Physics 11, 355–361.
Reid, J. (2003). The future of Fortran. Computing in Science & Engineering 5, 59–67.
Worth, D. J. (2008). State of the art in object oriented programming with fortran. Technical Report RAL-TR-2008-002.
fake - a shell script for generating Fortran makefiles.
FoBiS.py - a Python script for (automatic) building of modern complex Fortran project.
sfmakedepend - searches for Fortran style includes, C preprocessor includes, and module dependencies.
makedepf90 - Automatic dependency resolution and makefile creation given a set of Fortran sources. Resolves module dependencies, Fortran and C preprocessor includes and external procedures.
CMake - CMake is a cross-platform, open-source build system. It is similar to autoconf, but aims to be simpler, and has first class Fortran support. It includes automatic Fortran dependency resolution and can be used for unit and regression testing, software building, system introspection, cross-compilation, and redistributable software packaging. CMake can use different ‘generators’ to actually perform the build: make files, Visual Studio, Xcode and others.
An intrinsic inquiry function is a function whose result depends on the properties of its arguments rather than the actual values. The arguments may be undefined. Unless the description of an intrinsic inquiry function explicitly states otherwise, its arguments are permitted to be unallocated allocatable variables or undefined or disassociated pointers.
count(mask [, dim [, kind]]) counts the number of
.true. elements of
mask along the dimension of
dim is omitted then the number of ‘.true.’ is counted over the entire array.
dim is a scaler of type
integer in the range of where is the rank of
result = count(mask [, dim [, kind]])
mask- The type shall be
dim- (Optional) The type shall be
kind- (Optional) An
integerinitialization expression indicating the kind parameter of the result.
The return value is of type
integer and of kind
kind is absent, the return value is of default integer kind. The result has a rank equal to that of
program test_count integer, dimension(2,3) :: a, b logical, dimension(2,3) :: mask a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /)) b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /)) print '(3i3)', a(1,:) print '(3i3)', a(2,:) print * print '(3i3)', b(1,:) print '(3i3)', b(2,:) print * mask = a.ne.b print '(3l3)', mask(1,:) print '(3l3)', mask(2,:) print * print '(3i3)', count(mask) print * print '(3i3)', count(mask, 1) print * print '(3i3)', count(mask, 2) end program test_count
|Fortran 2008 features||Absoft||Cray||g95||GNU||HP||IBM||Intel||NAG||Oracle||PathScale||PGI|
|Compiler Version Number||14||8.1.1||4.7/4.8||14.1||14||5.3.1||4||14.1|
|Simply contiguous arrays||N||Y||?||Y||N||Y||Y||N||N||N||N|
|Long integers||Y (100)||Y||?||Y||N||Y||Y (100)||Y||Y||Y||Y|
|Allocatable components of recursive type||N||Y||?||N||N||N||P||N||N||N||N|
|Data statement restrictions lifted||?||Y||?||?||?||N||N||N||?||N||N|
|Kind of a forall index||N||Y||?||N||N||N||Y||N||N||N||N|
|Type statement for intrinsic types||?||Y||?||Y||?||Y||N||N||?||N||Y|
|Declaring type-bound procedures||?||Y||?||Y||?||Y||Y||Y||?||N||N|
|Accessing data objects||Absoft||Cray||g95||GNU||HP||IBM||Intel||NAG||Oracle||PathScale||PGI|
|Omitting an allocatable component in a structure component||?||Y||?||N||?||N||Y||Y||?||N||?|
|Copying bounds of source array in allocate||?||?||?||N||?||Y||Y||N||?||N||?|
|Allocating a polymorphic variable||N||Y||?||P (210)||N||P (213)||Y||Y||N||N||?|
|Accessing real and imaginary parts||N||Y||?||N||N||Y||N||N||N||N||Y|
|Elemental dummy argument restrictions lifted||?||Y||?||Y||?||N||N||N||?||?||Y|
|Finding a unit when opening a file||N||Y||?||Y||N||Y||Y||Y||N||N||Y|
|g0 edit descriptor||N||Y||?||Y||N||N||Y||N||N||N||N|
|Unlimited format item||N||Y||?||Y||N||N||Y||N||N||N||N|
|The block construct||N||Y||?||Y||N||Y||N||Y||N||N||N|
|Intrinsic procedures for bit processsing||Absoft||Cray||g95||GNU||HP||IBM||Intel||NAG||Oracle||PathScale||PGI|
|Bit sequence comparison||N||Y||?||Y||N||N||Y||Y||N||N||N|
|Counting bits||Y||Y||?||Y||N||Y||Y||Y||N||P (212)||P (214)|
|Bit transformational functions||N||Y||?||Y||N||N||Y||Y||N||N||N|
|Intrinsic procedures and modules||Absoft||Cray||g95||GNU||HP||IBM||Intel||NAG||Oracle||PathScale||PGI|
|Taking radix into account when selecting a real kind||N||Y||?||Y||N||Y||Y||Y||N||N||N|
|Extensions to trigonometric hyperbolic intrinsics||Y||Y||?||Y||N||Y||Y||Y||N||N||Y|
|Error and gamma functions||P||Y||?||Y||N||Y||Y||N||N||P||N|
|Euclidean vector norms||N||Y||?||Y||N||N||Y||Y||N||N||N|
|Execute command line||N||Y||?||Y||N||Y||N||Y||N||N||N|
|Location of max. or min. value in an array||N||Y||?||N||N||N||N||N||N||N||N|
|Find location in an array||?||Y||?||N||N||N||N||N||N||N||N|
|Programs and procedures||Absoft||Cray||g95||GNU||HP||IBM||Intel||NAG||Oracle||PathScale||PGI|
|Save attribute for module and submodule data||?||Y||?||Y||?||Y||Y||Y||?||N||N|
|Empty contains section||Y||Y||?||Y||N||Y||Y||Y||N||N||N|
|Form of end statement for internal and module procedures||?||Y||?||Y||?||Y||N||Y||?||N||Y|
|Internal procedure as an actual argument||N||Y||?||Y||N||Y||Y||N||N||N||N|
|Null pointer or unallocated allocatable as absent dummy arg.||N||Y||?||Y||N||Y||Y||N||N||N||N|
|Generic resolution by pointer or alloc. attr. - procedure||N||Y||?||N||N||N||N||Y||N||N||N|
|Generic resolution by pointer or alloc. attr. - data obj.||N||Y||?||N||N||N||N||Y||N||N||N|
|Elemental procedures that are not pure||N||Y||?||Y||N||N||N||Y||N||N||Y|
|Entry statement becomes obsolescent||N||Y||?||Y||N||Y||Y||Y||N||N||N|
|Semicolon at line start||Y||Y||?||Y||?||Y||N||Y||?||Y||Y|
Legend: Y = Yes, N = No, P = Partial, U = Unconfirmed
integer(kind=8); (200) Only for a single image; (202) Only MOLD=; (203) int and real, and coarray. (210) gfortran via allocate but not via intrinsic assignment (211) NAG has ALLOCATE(MOLD=), but not polymorphic assignment (212) Pathscale, counting bits, not trailz (213) Waiting for update from IBM (214) leads, popent, and poppar supproted. No trailz.
Changes January 2013:
Changes between December 2010 and April 2011:
Extended list of Fortran 2008 features.
Absoft: first issue with available data.
Partial support: Allocatable components of recursive type.
Full support: Coarrays, DO CONCURRENT, CONTIGUOUS attribute, Simply contiguous arrays, Maximum rank, Implied-shape array, Pointer initialization, Kind of a forall index, Allocating a polymorphic variable, MOLD= in ALLOCATE, NEWUNIT= in OPEN, G0 and G0.d edit descriptor, Unlimited format item, CONTAINS may be empty, Additional intrinsic procedures, Additional items in ISO_FORTRAN_ENV.
PGI: first issue with available data.
Changes between August 2010 and December 2010:
Partial support: pointer initialization.
Full support: CONTIGUOUS attribute, simply CONTIGUOUS arrays, implied-shape arrays, EXIT statement, bit sequence comparison, combined shifting, counting bits, masking bits, shifting bits, Bessel functions Euclidean vector norms, parity, execute command line, NULL pointer as a missing dummy argument, ELEMENTAL procedures that are not PURE, ENTRY statement becomes obsolescent.
Changes between April 2010 and August 2010:
Partial support: error and gamma functions.
Full support: coarrays, CONTIGUOUS attribute, simply contiguous arrays, allocating a polymorphic variable,
g0 edit descriptor, unlimited format item, BLOCK construct, stop code, bit sequence comparison, masking bits, selecting a real kind, arc tangent function, location of max or min value in an array, find location in an array, constants, and entry statement becomes obsolescent.
Errata: “null pointer as a missing dummy argument” changed from Y to N.
Partial support: coarrays, allocating polymorphic variables, and constants.
Full support: BLOCK construct, stop code, hyperbolic intrinsic functions, and arc tangent function.
HP: first issue with available data.
IBM: first issue with available data on Fortran 2008 features.
Changes between August 2009 and April 2010:
GFortran added full support for unlimited format items and the error and gamma functions and partial support for the block construct.
Sun added full support for parity.
The information in the above table is from “Compiler Support for the Fortran 2003 and 2008 Standards,” a recurring article in the Fortran Forum by Ian D. Chivers and Jane Sleightholme.
Fortran has a long history. Many other programming languages have come and gone over the life of Fortran. Part of this success is that Fortran has avoided the temptation of implementing new programming concepts. Unfortunately, the resistance to change has also been responsible for Fortran’s diminishing user base over the last 20 years. Fortran 2003 and 2008 fix the most glaring deficiencies, such as standardized C interoperability and better string support. But is it too late to prevent Fortran’s demise?
For this to work, you need the current version of the LLVM, the matching version of Dragonegg, which you will compile to create a library eg dragonegg.so, which is then called from gfortran/gcc using