Dan Nagle's Technical Site

Program preconvert

Home --> Fact Sheet --> Free Source Code --> preconvert

About the Program preconvert

Go directly to Downloads

Program preconvert applies a few preprocessing actions to fixed format source files which are to be processed with Michael Metcalf's convert program. The convert program converts fixed format source files to free format. By design, convert only operates on Fortran 77 standard conforming fixed format source files. There are three popular extensions which may cause difficulties, specifically, they are: include files, tabs in statement label fields, and the use of debug statements. preconvert handles these three extensions to produce fixed form source files which may be processed by convert without the possibility of encountering these difficulties.

If the source file has cpp-style #include directives, these may be processed by cpp. Therefore, preconvert handles only "standard" Fortran 77 include directives. Many Fortran 77 compilers allowed tab characters in fixed form source files. If a tab character appears in the statement label, which convert tries to read with a numeric format, it may abort the program. preconvert removes tabs from fixed format using the usual rules for tabs in fixed format source files. Some Fortran 77 compilers supported debug lines (with a 'D' or 'd' in column one), which were treated as comments unless a debug switch was set. preconvert changes these debug statements to standard comments.

preconvert operates similarly to convert. The program should be run interactively. When the program is run, a banner is printed to stdout and a single list-directed record is read from stdin. This record should have the name of the Fortran source file to be processed, T or F whether tabs should be removed, T or F whether debug lines should be converted to comments, T or F whether the beginning and end of include files should be marked in the output file, and the name of a preprocessor if sequences of debug lines are to be surrounded by conditional compilation directives (coco, f90ppr or fpp are currently supported). The file name should be entered without an extension.

The name will have ".for" appended and used as input; it will have ".f" appended and used as output. The defaults for all the others is T (true). For example, a response of "foo T F /" will process input foo.for resulting in foo.f with tabs removed, without debug lines changed to comments, and with the beginning and ends of include files marked in the output file. A response of "what T T F coco" will process what.for resulting in what.f with tabs removed, with debug lines surrounded by directives for the coco preprocessor, and without marking the beginning and end of include files.

Back to the Top


To download the preconvert program, click preconvert.

Back to the Top

Please see our Fact Sheet, or E-mail me for more information.

Home - Fact Sheet - Free Source Code - Fortran Links - Email me

Back to the Top