dcl-calc-command-indent

dcl-calc-command-indent is a compiled Lisp function in `dcl-mode.el'.

(dcl-calc-command-indent)

Calculate how much the current line shall be indented.
The line is known to be a command line.

Find the indentation of the preceding line and analyze its contents to
see if the current lines should be indented.
Analyze the current line to see if it should be `outdented'.

Calculate the indentation of the current line, either with the default
method or by calling dcl-calc-command-indent-function if it is
non-nil.

If the current line should be outdented, calculate its indentation,
either with the default method or by calling
dcl-calc-command-indent-function if it is non-nil.


Rules for default indentation:

If it is the first line in the buffer, indent dcl-margin-offset.

Go to the previous command line with a command on it.
Find out how much it is indented (cur-indent).
Look at the first word on the line to see if the indentation should be
adjusted. Skip margin-label, continuations and comments while looking for
the first word. Save this buffer position as `last-point'.
If the first word after a label is SUBROUTINE, set extra-indent to
dcl-margin-offset.

First word extra-indent
THEN +dcl-basic-offset
ELSE +dcl-basic-offset
block-begin +dcl-basic-offset

Then return to the current line and look at the first word to see if the
indentation should be adjusted again. Save this buffer position as
`this-point'.

First word extra-indent
ELSE -dcl-basic-offset
ENDIF -dcl-basic-offset
block-end -dcl-basic-offset


If dcl-calc-command-indent-function is nil or returns nil set
cur-indent to cur-indent+extra-indent.

If an extra adjustment is necessary and if
dcl-calc-command-indent-function is nil or returns nil set cur-indent
to cur-indent+extra-indent.

See also documentation for dcl-calc-command-indent-function.
The indent-type classification could probably be expanded upon.