- 2006 AGM
- Chairman's Report
- SG Dev Fund Report
- Membership Report
- Web Editor's Report
- About us
Fortran Specialist Group
(Note: FORTRAN is used here to describe pre-1990 versions of the language and Fortran for the more recent developments.)
From the mid 1980s to the early 2000s I worked on the maintenance and enhancement of FORTRAN programs for Computer Aided Design and Manufacturing mainly written in FORTRAN 77 but with some parts using FORTRAN 66.
During a spell of unemployment in the late 1990s I came across a book entitled "The F Programming language" by Metcalf and Reid. It described a subset of the Fortran 90 language which was "both highly regular, and thus easy to learn, and quite safe, and thus reliable to use". The book was published in 1996 but by 1998 when I bought my copy the suppliers of the F compiler, Imagine1 Inc., were no longer in business.
I started working again with FORTRAN 77 and my interest in the newer versions of the language faded. However, after 2001 I was no longer employed as a software developer but I still retained an interest in Fortran, indeed I was elected Chairman of the Fortran SG in May 2002!
In mid 2005 I began "improving" a boundary element modelling package which I had worked on in the 1980s and ported to MS-DOS in the late 1990s. It ran as a series of console applications in a command prompt window under MS Windows. I did not have any Fortran compiler available but I found and downloaded the open source MinGW (Minimalist GUI for Windows) package which included the GNU Compiler Collection g77 FORTRAN 77 compiler and gcc C compilers. I was able to produce satisfactory console mode applications using C for the command line interface and FORTRAN 77 for the main application code.
After this I attempted to rebuild a complete CAD/CAM program which I had worked on up to 2001 using the same two compilers. I did manage to compile all the source code and build an executable but there were a number of problems with running the code which I did not bottom out.
The work I am going to describe began as a way of simplifying the task of reformatting and updating the statistics pages of the FSG website.
Since early 2003 I have received, as Web Editor for the Fortran Specialist Group, each month a number of HTML files from the web support staff at BCS HQ which contain the activity statistics for the Fortran Group web pages for the previous month. I used to re-format them by hand, which was boring and labour intensive. That's why the stats are over 12 months behind!
I produced annual summary pages by taking data from the monthly pages as text and converting it into a CSV (Comma Separated Variable) format file which I used to produce HTML files via the OpenOffice spreadsheet application. The graphic files produced had automatically generated non-intuitive names.
During my second spell of unemployment in the early 2000s I went on a introductory course for Java programming, hoping to increase my employability! As an exercise I wrote a GUI based Java application, RenameJpegs, to give the graphics files more meaningful names and update the references to them in the HTML files.
Because I had fallen badly behind with with updating the website with the statistics files I looked at ways of automating the conversion process, especially for the annual summary files.
In September 2005 I converted my earlier Java application into two programs, Text2CSV and Text4CSV. The former took a text file containing all the relevant data for one month and converted it into a CSV file while the latter took a text file containing all the visible text from one HTML file plus tags marking the beginning and end of the relevant data and converted it into a CSV file. I chose the CSV format because it uses human readable files which can be read into both spreadsheet and database applications.
I was not very happy with the Object Orientated paradigm of Java and I was interested in learning more about the "new" developments in Fortran, beyond FORTRAN 77, which I had read about in the description of the F language and come across again when I prepared a presentation for the BCS Wolverhampton Branch which I gave in March 2005 on "Fortran - A Language with a Past and a Future".
Working with Fortran 95, 2003 and F
All the Fortran programs I shall describe are console mode applications which run in a command prompt window under MS Windows XP Pro.
To explore F and/or Fortran 90/95 I needed a more modern compiler. I found one at the open-source G95 project.
Using the G95 compiler together with the MinGW libraries, I began by re-writing Text2CSV in F/Fortran 2003, using the std=F and std=f2003 compiler options where appropriate. I used this makefile and the GF and FORT batch files to compile and build the application.
I used the Fortran 2003 command_argument_count() and get_command_argument
routines so that I did not have to use any C code for the command line user interface.
I also used the free-form source format written in lowercase. This is the
file_date module as an example.
Please note that I do not put forward any of my code as good examples of coding style, layout or algorithms - it just works for me and is accepted by the compilers!
In July 2005 I attended a seminar on "Building Dynamic Websites with PHP and MySQL" which outlined how you could store information in an open-source MySQL database and then extract the data and format it into HTML pages using the open-source PHP scripting language.
I then decided to try writing out the data to a series of HTML files with the Text2PHP program. Five of the generated files have a .php extension but the only PHP in them is the "include (file-name)" command, to include blocks of common HTML code. This is the makefile I used to compile and build the program.
I then decided to take the next step and try reading the as-supplied HTML files directly. To do that I produced the HTML2text application. The text file output was intended to be the input to the Text2PHP program. From there it was a small step to the HTML2all program which read the HTML files and then wrote out text, CSV, PHP and HTM files.
By this time, November 2005, I had been on a two day PHP and MySQL course so I decided to change HTML2all to write out a "proper" PHP file containing SQL INSERT queries which would store the data in a MySQL database as well as the text and CSV files. The program will read either four, pre-May04, five, pre-Nov05, or five out of seven post-Oct05 files. This is the makefile I used to compile and build the program and this is the source file for the main program.
Up to this point, the end of 2005, I had only used the G95 compiler. When I had the HTML2all program working satisfactorily I started to look at the GNU Compiler Collection gfortran Fortran 95 compiler, from which the G95 compiler was a development branch. I also found that a free F compiler was now available from The Fortran Company, based on the Nagware Fortran 95 compiler.
Among the differences which I found between the compilers was the range of compiler options available.
G95 supports std=F, f95 and f2003
gfortran supports std=gnu, f95, f2003 and legacy
F has no std= option
Also there was a range of file extensions which are supported.
G95 supports .f, .F, .for, .FOR, .f90, .F90, .f95, .F95, .f03 and .F03
gfortran supports .f, .f90 and .f95
F supports .f90, .F90, .f95 and .F95
Because of these differences I found I needed a different makefile for each compiler and because the F compiler did not support the Fortran 2003 features I was using I had to write a F specific command line processing module. Also I had to write compiler specific routines to display I/O error messages.
This table shows the different source files and make files I used to build the program using the three different compilers.
The F compiler was much stricter than the others about what you could do within functions. My get_file_name function was only calling subroutines which only used console I/O but I had to convert it to a subroutine in order to get it to compile!
Fortran SG Chairman
revised December 2006
Last modified: Wed 9 Jan 2013 19:08:56