table of contents
FINDENT(1) | User Commands | FINDENT(1) |
NAME¶
findent - Indents and optionally converts Fortran program source
SYNOPSIS¶
findent [OPTION]...
Findent reads from STDIN and writes to STDOUT.
DESCRIPTION¶
Findent indents a Fortran source. Findent uses various kinds of
indentations, see OPTIONS. Findent can convert from fixed form to free form,
and can supplement single END statements, see 'Refactor' below. Comment
lines with '!' in column one are not indented.
You can correct findent related indenting errors by inserting comment lines:
! findentfix: <fortran statement>
where <fortran statement> is for example DO, END, WHERE() etcetera.
Findent will adjust the indentation according to <fortran statement>.
Errors in OPTIONS are silently ignored.
General options:¶
Below: <n> denotes an unsigned decimal number.
<c> denotes a character.
In the long options, you can replace '_' with '-'.
- -h, --help
- print this text
- -H, --manpage
- print man page
- --readme
- print some background information
- -v, --version
- prints findent version
- -q, --query_fix_free
- guess free or fixed, prints 'fixed' or 'free' and exits
- --continuation=<c>
-
' ': (default) do not change continuation characters
'0': create numbered continuation characters
other: use that continuation character
default for conversion from free to fixed is '&' - --include_left=<n>
- (0/1) 1: indent include statements to starting indent (default:0)
- -l<n>, --label_left=<n>
- (0/1) 1: move statement labels to start of line (default:1)
(only for free format) - -lastindent, --last_indent
- prints computed indentation of last line
(for usage with vim) - -lastusable, --last_usable
- prints line number of last line usable
as start for indenting(for usage with vim) - -iauto, --input_format=auto
- determine automatically input format (free or fixed)
- -ifixed, --input_format=fixed
- force input format fixed (default: auto)
- -ifree, --input_format=free
- force input format free (default: auto)
- -i-, --indent=none
- do not change indent (useful in combination with -R)
- -L<n>, --input_line_length=<n>
- use only first <n> characters of each line default=0: take whole lines
- -L<n>g, --input_line_length=<n>g
- same as above, but use gfortran convention for counting the characters
with tabbed lines
example: --input_line_length=72g - -M<n>, --max_indent=<n>
- maximum output indent, default 100, 0: no limit
- -ofixed, --output_format=fixed
- force fixed format output
- -ofree, --output_format=free
- force free format output
- -osame, --output_format=same
- output format same is input format
- --openmp=<n>
-
0: do not indent openmp conditionals
1: indent openmp conditionals (default)
NOTE: for free format, the omp sentinel must be '!$ ' - -Rr, --refactor_procedures
- refactor procedures and modules: the END line
of a subroutine, program etc. is, if possible, replaced by
'end subroutine <name>' or
'end function <name>' or
'end procedure <name>' or
'end program <name>' or
'end block data <name>' or
'end module <name>' or
'end submodule <name>'
where <name> is the name of the appropriate procedure, subroutine etc.
NOTE1: if the END line contains a continuation the results are undefined
NOTE2: a line like 'end function fun' will be replaced by
'end subroutine sub' if the END line ends 'subroutine sub' - -RR, --refactor_procedures=upcase
- same as -Rr, but 'END SUBROUTINE <name>' in stead of 'end subroutine <name>' etc.
Indenting options:¶
- -I<n>, --start_indent=<n>
- starting indent (default:0)
- -Ia, --start_indent=a
- determine starting indent from first line
- -i<n>, --indent=<n>
- all indents except I,c,C,e (default: 3)
- -a<n>, --indent_associate=<n>
- ASSOCIATE indent
- -b<n>, --indent_block=<n>
- BLOCK indent
- -d<n>, --indent_do=<n>
- DO indent
- -f<n>, --indent_if=<n>
- IF indent
- -E<n>, --indent_enum=<n>
- ENUM indent
- -F<n>, --indent_forall=<n>
- FORALL indent
- -j<n>, --indent_interface=<n>
- INTERFACE indent
- -m<n>, --indent_module=<n>
- MODULE indent
- -r<n>, --indent_procedure=<n>
- FUNCTION,
SUBROUTINE and PROGRAM indent - -s<n>, --indent_select=<n>
- SELECT indent
- -t<n>, --indent_type=<n>
- TYPE indent
- -w<n>, --indent_where=<n>
- WHERE indent
- -x<n>, --indent_critical=<n>
- CRITICAL indent
- --indent_changeteam=<n>
- CHANGE TEAM indent
- -C-, --indent_contains=restart,
- restart indent after CONTAINS
- -k<n>, --indent_continuation=<n>
- continuation indent except
for lines starting with '&'
free to free only - -k-, --indent_continuation=none
- continuation lines not preceded
by '&' are untouched
free to free only - next defaults are: all - all/2
- -c<n>, --indent_case=<n>
- CASE negative indent
- -C<n>, --indent_contains=<n>
- CONTAINS negative indent
- -e<n>, --indent_entry=<n>
- ENTRY negative indent
Dependencies:¶
- --deps
- output dependency information only, other flags are ignored. This can be
used to generate a dependencies file for usage with make(1).
The format of this information:
Fortran source -> findent output
include "file1" -> inc file1
#include "file2" -> cpp file2
#include <file3> -> std file3
??include 'file4' -> coc file4
use module1 -> use module1
submodule(m) subm -> use m
mod m:subm
module module2 -> mod module2 - --makefdeps
- outputs a sh(1) script that serves as a an example
to generate dependencies for use in make(1).
Environment:¶
findent parses the environment variable FINDENT_FLAGS before the command-line flags
Usage with vim:¶
- --vim_help
- outputs directions to use findent in (g)vim
- --vim_fortran
- outputs file 'fortran.vim', see --vim_help
- --vim_findent
- outputs file 'findent.vim', see --vim_help
Usage with gedit:¶
- --gedit_help
- outputs directions to use findent in gedit
- --gedit_external
- outputs script 'findent-gedit', see --gedit_help
- --gedit_plugin
- outputs file 'findent.plugin', see --gedit_help
- --gedit_plugin_py
- outputs file 'python.py', see --gedit_help
Usage with emacs:¶
- --emacs_help
- outputs directions to use findent in emacs
- --emacs_findent
- outputs script 'findent.el', see --emacs_help
Examples:¶
indent: findent < in.f > out.f
findent -i2 -r0 < in.f > out.f
convert fixed to free form: findent -ofree < prog.f > prog.f90
convert free to fixed form: findent -ofixed < prog.f90 > prog.f
refactor 'end': findent -Rr < in.f90 > out.f90
BUGS:¶
- *
- Also for free-format, findent is space-insensitive, while the standard states that space must be used as general separator.
- *
- There are some issues with labels in a continuation when converting from
free to fixed format. For example:
123&
4 continueThe problems arise because it is not possible to define a statement label in a continuation in fixed format.
- *
- When converting from fixed format to free format, findent discards white
space in a string if the string contains a continuation, e.g:
print *,"a
+b"is converted to:
print *,"a&
&b"
DONATIONS¶
Donations to support the maintenance of this program are welcome: https://paypal.me/wvermin
COPYRIGHT¶
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2019 | findent-3.1.7 |