2.24 Source File Polishing

The polisher takes a set of Fortran source files, which may be in fixed or free form, and produces a free form “polished” version of each file. C files and fpp-processed files are not handled.

The polisher understands the following compiler options with the same meaning: -132, -encoding, -english, -f2003, -f2008, -f95, -fixed, -free, -help, -I, -indirect, -info, -maxcontin, -nihongo, -noqueue, -o, -openmp, -Qpath, -tempdir, -v, -V, -w and -xlicinfo.

The polished output is written to the file specified by the -o option, or to the same filename with the extension replaced by ‘.f90_pol’ if no -o option is specified. The output file cannot have the same name as the input file.

The following additional options control the operation of the polisher:

-align_right_continuation
Align the continuation markers (ampersands) at the end of a continued line to column N+2, where N is the normal line width (specified by the -width= option). This only affects lines that do not end with an inline comment.
-alter_comments
Enable options to alter comments; without this option, any options that would otherwise alter the comments are ignored.
-array_constructor_brackets=X
Specify the form to use for array constructor delimiters; X must be one of Asis (same as the input file), ParenSlash (use parentheses+slash pairs, i.e. ‘(/ ... /)’) or Square (use square brackets, i.e. ‘[ ... ]’). The default is -array_constructor_brackets=Asis.
-blank_cmt_to_blank_line
Turn comment lines that have no text (other than the comment-initiating character) into plain blank lines; this is the default if the -alter_comments option is set.
-blank_line_after_decls
Ensure that there is a blank line after the declarations and before the first executable statement; this is the default.
-bom=X
Specify whether to write a Unicode Byte-Order Mark at the beginning of the output file; X must be one of Asis (same as the input file), Insert (insert a byte-order mark) or Remove (remove any byte-order mark). This option only has effect if the input file is known to be in UTF-8 encoding, either because it begins with a byte-order mark or the -encoding=UTF8 option was used. The default is -bom=Asis.
-break_long_comment_word
If a comment line will be split into two lines, the comment may be broken in the middle of a long word.
-character_decl=style
Specify the style to be used for CHARACTER type declaration statements; style must be one of the following (not case-sensitive):

Asis (same as the input statement, but obey any -kind_keyword= option),
Keywords (use LEN= and KIND=),
Kind_Keyword_Only (use KIND= but not LEN=) or
No_Keywords (use modern style with no keywords).

The default is Asis; with any other style, the obsolescent “CHARACTER*length” form will be changed to the modern “CHARACTER(length)” form. When both the length and kind appear in the input statement, the length will appear first in the output statement.

-commas_in_formats=X
Specify whether to add optional commas in FORMAT statements; X must be one of Asis (use the same comma scheme as the input), Insert or Remove. The default is -commas_in_formats=Insert.
-dcolon_column=N
Align double colon ‘::’ in declarations at column N and align any subsequent continuation lines to match. The default is for no special alignment, which is equivalent to -dcolon_column=0.
-dcolon_in_decls=X
Specifies how to handle the optional double colon ‘::’ in declarations; X must be one of Asis (preserve the input status), Insert (insert ‘::’ if not present), or Remove (remove ‘::’ if present and optional); the default is -dcolon_in_decls=Asis.
-delete_all_comments
Delete all comments (if the -alter_comments option is set).
-delete_blank_lines
Delete blank lines and comment lines that have no text (other than the comment-initiating character), if the -alter_comments option is set.
-delete_unused_labels
Delete labels that are never referenced; this is the default.
-format_start=N
If renumbering FORMAT statements in a separate sequence, the first FORMAT statement will be N; the default is -format_start=90000.
-format_step=N
If renumbering FORMAT statements in a separate sequence, the step from one label to the next will be N; the default is -format_step=10. Note that this may be negative (but not zero).
-idcase=X
Set the case to use for identifiers; X must be one of Asis, Capitalised, lowercase, UPPERCASE, Camel_Case, or an abbreviation thereof (both C and Ca are treated as Capitalised, not Camel_Case); the default is -idcase=lowercase. The interpretation of X is not case-sensitive (e.g. -idcase=u is the same as -idcase=U). Note that -idcase=Asis is only available for basic polishing (=polish), not in Enhanced Polish (=epolish) or any other tool (e.g. =unifyprecision).
-indent=N
Indent statements within a construct by N spaces from the current indentation level; the default is -indent=2.
-indent_comment_marker
When indenting comments, the comment-initiating character should be indented to the indentation level; this is the default.
-indent_comments
Indent comments; this is the default if the -alter_comments option is set. The result is also affected by the -indent_comment_marker option.
-indent_continuation=N
Indent continuation lines by an additional N spaces; the default is -indent_continuation=2.
-indent_max=N
Set the maximum indentation level to N spaces; the default is -indent_max=60. The value must be at least 10 less than the output line length (-width=).
-inline_comment_indent=N
Set the indentation level for inline comments to column N; the default is -inline_comment_index=35.
-keep_blank_lines
Do not delete blank lines or comment lines with no text; this is the opposite of -delete_blank_lines and is the default.
-keep_comments
Do not delete non-blank comment lines; this is the opposite of -delete_comments and is the default.
-keep_unused_labels
Do not delete unused (unreferenced) labels; this is the opposite of -delete_unused_labels.
-kind_keyword=X
Specifies how to handle the KIND= specifier in declarations; X must be one of Asis (take no action but preserve the input status), Insert (insert KIND= if not present), or Remove (remove KIND= if present); the default is -kind_keyword=Asis.
-kwcase=X
Set the case to use for language keywords; X must be one of Capitalised, lowercase, UPPERCASE, Camel_Case, or an abbreviation thereof (both C and Ca are treated as Capitalised, not Camel_Case); the default is -kwcase=Capitalised. The interpretation of X is not case-sensitive (e.g. -kwcase=u is the same as -kwcase=U). The -kwcase=C produces ‘Double Precision’ and ‘Non_recursive’; with -kwcase=Camel, the latter is produced as ‘Non_Recursive’.
-label_after_indent
Indent labels; this is the opposite to -label_before_indent.
-label_before_indent
Output the statement label, if any, before indenting the statement; this is the default.
-leave_formats_in_place
Leave FORMAT statements in the same position as they are in the input file; this is the opposite of -move_formats_to_end, and is the default.
-margin=N
Set the left margin (initial indent) to N. The value must be at least 10 less than the output line length (-width=). The default value for the left margin is 4.
-move_formats_to_end
Move FORMAT statements to the end of the subprogram or program unit, immediately before the CONTAINS or END statement.
-name_scopes=X
Specify whether to add optional keywords and scope names to the END or END TYPE statement for a scope; X must be one of Asis (leave as is), Insert (insert keywords and/or names), Keywords (insert keywords but remove names) or Remove (remove optional keywords and names). This option also applies to the END INTERFACE statement. The default is -name_scopes=Keywords.
-noalign_right_continuation
Do not align the continuation markers (ampersands) at the end of continued lines; this is the default.
-noalter_comments
Do not alter comments in any way; this is the default.
-noblank_cmt_to_blank_line
Do not turn blank comments to blank lines.
-noblank_line_after_decls
Do not insert a blank line between the last declaration and the first executable statement.
-nobreak_long_comment_word
If a comment line will be split into two lines, do not break the comment in the middle of a long word; this is the default.
-nodcolon_column
Do not align double colon ‘::’ in declarations. This is the default, and is equivalent to specifying alignment at column zero via -dcolon_column=0.
-noindent_comment_marker
Place the comment-initiating character for a comment line in column 1.
-noindent_comments
Do not indent the text of a comment line.
-norenumber
Do not renumber statement labels.
-noseparate_format_numbering
When renumbering statement labels, use a single sequence for both FORMAT and non-FORMAT statements; this is the default.
-noterminate_do_with_enddo
Do not change DO loop terminating statements.
-nowrap_comments
Do not wrap long comment lines (they will still be indented if comments are being indented).
-relational=X
Specifies the form to use for relational operators, X must be either F77- (use .EQ., .LE., etc.) or F90+ (use ==, <=, etc.); the default is -relational=F90+.
-renumber
Renumber statement labels; this is the default.
-renumber_start=N
When renumbering statement labels, the first label will be N; the default is -renumber_start=100.
-renumber_step=N
When renumbering statement labels, the step from one label to the next will be N; the default value is -renumber_step=10.
-separate_format_numbering
When renumbering statement labels, renumber FORMAT statements in a separate sequence from non-FORMAT statements.
-terminate_do_with_enddo
Change the terminating statements of all DO loops so that each loop ends with an ENDDO statement; this is the default.
-width=N
Set the maximum length of the text on each output line to N; the default is -width=78. Note that in the case of continuation lines, an additional two characters (‘ &’) will be produced after the last text on a line and this may take the line length over the limit. The width must be at least 10 more than the left margin (-margin=) and the maximum indent (-indent_max=). The maximum width setting is 1024, however values higher than 130 will produce output that does not conform to the Fortran standard.
-wrap_comments
Wrap long comment lines that would otherwise exceed the maximum line length. This is the default.