.\" DO NOT MODIFY THIS FILE! It was created by findent \-H .TH FINDENT "1" "2023" "findent\-4.3.2" "User Commands" .SH NAME findent \- Indents, converts and relabels Fortran programs. .SH SYNOPSIS .B findent [\fIOPTION\fR]... .PP Findent reads from STDIN and writes to STDOUT. .SH DESCRIPTION Findent indents and optionally relabels a Fortran source. Findent can convert from fixed form to free form and vice-versa, 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: where is for example DO, END, WHERE() etcetera. Findent will adjust the indentation according to . Errors in OPTIONS are silently ignored. Options marked with [NO_ENV] are ignored if given via environment variable FINDENT_FLAGS. In the long options, you can replace '_' with '-'. Below: denotes an unsigned decimal number. denotes a character. .PP .SS "General options: .TP \fB\-h, \-\-help \fR print this text. [NO_ENV] .TP \fB\-H, \-\-manpage \fR print man page. [NO_ENV] .TP \fB\-\-readme \fR print some background information. [NO_ENV] .TP \fB\-\-changelog \fR print ChangeLog. [NO_ENV] .TP \fB\-v, \-\-version \fR prints findent version. [NO_ENV] .TP \fB\-q, \-\-query_fix_free \fR guess free or fixed, prints 'fixed' or 'free' and exits. [NO_ENV] .TP \fB\-\-continuation= \fR ' ': (default) do not change continuation characters. '0': create numbered continuation characters. other: use that continuation character. default for conversion from free to fixed is '&'. .TP \fB\-\-include_left= \fR (0/1) 1: indent include statements to starting indent (default:0). .TP \fB\-l, \-\-label_left= \fR (0/1) 1: move statement labels to start of line. (default: free: 1, fixed: 0) .TP \fB\-lastindent, \-\-last_indent \fR prints computed indentation of last line. (for usage with vim) [NO_ENV] .TP \fB\-lastusable, \-\-last_usable \fR prints line number of last line usable. as start for indenting(for usage with vim). [NO_ENV] .TP \fB\-iauto, \-\-input_format=auto \fR determine automatically input format (free or fixed). .TP \fB\-ifixed, \-\-input_format=fixed \fR force input format fixed (default: auto). .TP \fB\-ifree, \-\-input_format=free \fR force input format free (default:auto). .TP \fB\-i\-, \-\-indent=none \fR do not change indent (useful in combination with \-R). .TP \fB\-L, \-\-input_line_length= \fR use only first characters of each line. default=0: take whole lines. .TP \fB\-Lg, \-\-input_line_length=g \fR same as above, but use gfortran convention. for counting the characters with tabbed lines. example: \-\-input_line_length=72g. .TP \fB\-M, \-\-max_indent= \fR maximum output indent, default 100, 0: no limit. .TP \fB\-ofixed, \-\-output_format=fixed \fR force fixed format output. .TP \fB\-ofree, \-\-output_format=free \fR force free format output. .TP \fB\-osame, \-\-output_format=same \fR output format same is input format. .TP \fB\-\-openmp= \fR 1/0: do/don't indent openmp conditionals (default: 1). NOTE: for free format, the omp sentinel must be '!$ '. .TP \fB\-Rr, \-\-refactor_end \fR refactor subroutines etc: the END line. of a subroutine, program etc. is, if possible, replaced by 'end subroutine ' or 'end function ' or 'end procedure ' or 'end program ' or 'end block data ' or 'end module ' or 'end submodule ' 'end interface ' 'end type ' where 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'. NOTE3: the flag \-\-refactor_procedures is deprecated, use \-\-refactor_end. .TP \fB\-RR, \-\-refactor_end=upcase \fR same as \-Rr, but 'END SUBROUTINE '. in stead of 'end subroutine ' etc. .TP \fB\-\-relabel=shuffle \fR shuffles existing labels, primarily meant for demo and debugging. see also the notes under \-\-relabel below. .TP \fB\-\-relabel, \-\-relabel=, \fR renumber labels: n1 = starting index, n2 is increment (default:1000,10). if n1=0 or n2=0, relabeling is disabled. see also RELABEL below. NOTE1: use only SYNTAX\-CORRECT SOURCES with this option. NOTE2: CHECK the functionality of your program after using this option. NOTE3: after finding an error (missing label, ill formatted label list, ...) findent will stop relabeling, but will continue indenting and/or converting. .TP \fB\-\-relabel_reset= \fR 1: reset label numbering at start of subroutine/function/program. 0: do not reset label numbering (default: 0). .TP \fB\-\-query_relabel[=] \fR generate report. [NO_ENV] n=0, or flag omitted: do not generate report. n=1: generate summary (only error message or OK message). n=2: generate report of original and renumbered labels (default). NOTE: if n >= 0, no output of the fortran source. .TP \fB\-\-ws_remred[=] \fR replace redundant white space with one space. n=0, or flag omitted: do not replace redundant spaces. NOTE1: use with care, avoid pieces of code with not terminated strings and use Fortran code without syntax errors: changes are irreversible. NOTE2: for statements containing an hollerith, this flag is ignored. .TP \fB\-\-safe \fR ignore next flags marked with [NO_ENV] (used by wfindent). .PP .SS "Indenting options: .TP \fB\-I, \-\-start_indent= \fR starting indent (default:0). .TP \fB\-Ia, \-\-start_indent=a \fR determine starting indent from first line. .TP \fB\-i, \-\-indent= \fR all indents except I,c,C,e (default: 3). .TP \fB\-a, \-\-indent_associate= \fR ASSOCIATE indent. .TP \fB\-b, \-\-indent_block= \fR BLOCK indent. .TP \fB\-d, \-\-indent_do= \fR DO indent. .TP \fB\-f, \-\-indent_if= \fR IF indent. .TP \fB\-E, \-\-indent_enum= \fR ENUM indent. .TP \fB\-F, \-\-indent_forall= \fR FORALL indent. .TP \fB\-j, \-\-indent_interface= \fR INTERFACE indent. .TP \fB\-m, \-\-indent_module= \fR MODULE indent. .TP \fB\-r, \-\-indent_procedure= \fR FUNCTION, SUBROUTINE and PROGRAM indent. .TP \fB\-s, \-\-indent_select= \fR SELECT indent. .TP \fB\-t, \-\-indent_type= \fR TYPE indent. .TP \fB\-w, \-\-indent_where= \fR WHERE indent. .TP \fB\-x, \-\-indent_critical= \fR CRITICAL indent. .TP \fB\-\-indent_changeteam= \fR CHANGE TEAM indent. .TP \fB\-C\-, \-\-indent_contains=restart, \fR restart indent after CONTAINS. .TP \fB\-k, \-\-indent_continuation= \fR continuation indent except for lines starting with '&' (see flag \-K). NOTE: free to free only. .TP \fB\-k\-, \-\-indent_continuation=none \fR continuation lines not preceded by '&' are untouched. NOTE: free to free only. .TP \fB\-kd, \-\-indent_continuation=default\fR continuation lines not preceded by '&' are default indented. NOTE: free to free only. .TP \fB\-K, \-\-indent_ampersand \fR indent lines starting with '&' (free only). .TP \fB\-\-align_paren[=] \fR align continuation lines not preceded by '&' with preceding unmatched left parenthesis. n=0, or flag omitted: do not align. n=1: do align (default). NOTE1: free to free only. NOTE1: for statements containing an hollerith, this flag is ignored. .TP \fB \fR Next defaults are: all \- all/2. .TP \fB\-c, \-\-indent_case= \fR CASE negative indent. NOTE: also for RANK, TYPEIS and CLASSIS. .TP \fB\-C, \-\-indent_contains= \fR CONTAINS negative indent. .TP \fB\-e, \-\-indent_entry= \fR ENTRY negative indent. .PP .SS Dependencies: .TP \fB\-\-deps \fR output dependency information only, other flags are ignored. [NO_ENV] 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 \-> std file3 ??include 'file4' \-> coc file4 use module1 \-> use module1 submodule(m) subm \-> use m mod m:subm module module2 \-> mod module2 .TP \fB\-\-makefdeps \fR outputs a sh(1) script that serves as a an example to generate dependencies for use in make(1). [NO_ENV] .PP .SS "Environment: findent parses the environment variable FINDENT_FLAGS before the command\-line flags. .PP .SS "Usage with vim: .TP \fB\-\-vim_help \fR outputs directions to use findent in (g)vim. [NO_ENV] .TP \fB\-\-vim_fortran \fR outputs file 'fortran.vim', see \-\-vim_help. [NO_ENV] .TP \fB\-\-vim_findent \fR outputs file 'findent.vim', see \-\-vim_help. [NO_ENV] .PP .SS "Usage with gedit: .TP \fB\-\-gedit_help \fR outputs directions to use findent in gedit. [NO_ENV] .TP \fB\-\-gedit_external \fR outputs script 'findent\-gedit', see \-\-gedit_help. [NO_ENV] .TP \fB\-\-gedit_plugin \fR outputs file 'findent.plugin', see \-\-gedit_help. [NO_ENV] .TP \fB\-\-gedit_plugin_py \fR outputs file 'python.py', see \-\-gedit_help. [NO_ENV] .PP .SS "Usage with emacs: .TP \fB\-\-emacs_help \fR outputs directions to use findent in emacs. [NO_ENV] .TP \fB\-\-emacs_findent \fR outputs script 'findent.el', see \-\-emacs_help. [NO_ENV] .PP .SS "Self replication: .TP \fB\-\-selfrep \fR outputs source tar ball to stdout [NO_ENV] Example: create the tar.gz file: findent \-\-selfrep > findent.tar.gz Example: create the unpacked source tar ball: findent \-\-selfrep | tar zxf \- .PP .SS "RELABEL: The following constructs are candidates for relabeling: \- 100,110,120,130: label \- X: integer or real or logical expression \- I: identifier \- [,]: optional comma \- ...: not parsed by findent, can be anything except '=...' \- [IF]: optional IF(...) 100 ... ! statement or format label IF(...) 110,120,130 IF(...) 110,120 DO 100[,] I=X,... DO 100[,] WHILE(...) DO 100[,] CONCURRENT(...) DO 100 [IF] ACCEPT 100... [IF] ASSIGN 100 TO I [IF] BACKSPACE(...,ERR=100,...) [IF] CALL I(...,*100,...,$110,...,&120,...) [IF] CLOSE(...,ERR=100,...) [IF] DECODE(...,100,...,ERR=110,...) [IF] DELETE(...,ERR=110,...) [IF] ENCODE(...,100,...,ERR=110,...) [IF] ENDFILE(...,ERR=100,...) [IF] FIND(...,ERR=110,...) [IF] FLUSH(...,ERR=100,...) [IF] GOTO 100 [IF] GOTO I[,](100,110,120) [IF] GOTO(100,110,120)... [IF] INQUIRE(...,ERR=100,...) [IF] OPEN(...,ERR=100,...) [IF] PRINT 100... [IF] READ 100... [IF] READ(...,100,...) [IF] READ(...,ERR=100,...,END=110,EOR=120,...,FMT=130)... [IF] REREAD 100... [IF] REREAD(...,100,...) [IF] REREAD(...,ERR=100,...,END=110,EOR=120,...,FMT=130)... [IF] REWIND(...,ERR=100,...) [IF] REWRITE(...,100) ... [IF] REWRITE(...,ERR=100,...,FMT=110,...,EOR=120)... [IF] TYPE 100... [IF] WAIT(...,ERR=100,...,END=110,...,EOR=120,...) [IF] WRITE(...,100) ... [IF] WRITE(...,ERR=100,...,FMT=110,...,EOR=120)... .PP .SS Examples: Indent: findent < in.f > out.f findent \-i2 \-r0 < in.f > out.f Relabel: findent \-\-relabel < 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 .PP .SS BUGS: .TP \fB*\fR Also for free\-format, findent is space\-insensitive, while the standard states that space must be used as general separator. .TP \fB*\fR There are some issues with labels in a continuation when converting from free to fixed format. For example: 123& 4 continue The problems arise because it is not possible to define a statement label in a continuation in fixed format. .TP \fB*\fR 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" .TP \fB*\fR Relabel issues In some cases, findent refuses to relabel. To see the cause, use the flag '\-\-query\-relabel=1', e.g.: findent \-\-relabel=10,10 \-\-query\-relabel=1 If the fortran source contains label\-related errors, or when findent misbehaves, relabeling can create havoc. So: test. .SH DONATIONS .br Donations to support the maintenance of this program are welcome: https://paypal.me/wvermin .SH COPYRIGHT .br This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.