Reformatting FORTRAN Programs

Believe it or not, there are still folks out there who are committed to the FORTRAN programming language. It is not my intention to start a religious war over the merits or demerits of any particular language, but to offer a tool which attempts to provide a structured look to a FORTRAN program for easier reading and understanding of code.

What It Is

If you use FORTRAN but don't like having to enforce a particular indenting style in your source code, you can run this program on your source program to provide indentation and to fix line-breaking over continuation lines. I'm afraid that the program makes most of the formatting decisions for you, and there is almost nothing that is customizable a la GNU's indent program for C. It sounds like fascism, but I wrote this thing to reformat a bunch of programs we had obtained, and I needed something ``quick and dirty'' to to provide nice listings. When running in listing mode, fpret can also provide an index of subroutines, entry points, functions, and programs.


The program fpret is written in the C language, so you will need a C compiler. If you want to produce a program listing, you will also need TeX, Donald Knuth's excellent typesetting program. I have only compiled this program on Sun systems under SunOS4.1.x, so your mileage may vary.


The following link will download a shar (SHell ARchive) file which contains instructions for compiling and running fpret, as well as the program source file itself. You must switch your WWW browser into a mode which will save the downloaded information as a file before activating the link. Once downloaded, the files in the archive may be unpacked with the following command (assuming a UNIX OS):

sh filename

BEWARE! The newer test version will allow some Fortran90 constructs, and attempts to fix a bug in the previous version which arises when a FORTRAN comment comes between a statement and a continuation line. I have not fully tested this version (as if I really even attempted to "fully test" the first version -- but at least I have some experience with it).

If you have suggestions about the formatting that fpret produces, or features, bugs, etc., you wish to report, then e-mail me at bret at met dot fsu dot edu.