1 Comments

indent distinguishes between several kinds of comments, and formats them differently.

@def{boxed comments} are, for example, those which are completely enclosed in a rectangle of stars or dashes, hence the name. Boxed comments are defined those in which the initial ‘/*’ is followed immediately by the character ‘*’ or ‘-’, or those in which the beginning comment delimiter (‘/*’) is on a line by itself, and the following line begins with a ‘*’ in the same column as the star of the opening delimiter.

Examples of boxed comments are:

/**********************
 * Comment in a box!! *
 **********************/

       /*
        * A different kind of scent,
        * for a different kind of comment.
        */

indent attempts to leave boxed comments exactly as they are, so
the indentation of the comment is unchanged, and its length is not
checked in any way.  The only alteration made is that an embedded tab
character may be converted into the appropriate number of spaces.

Comments which are not boxed may be formatted, which means that the
line is broken to fit within a right margin and left-filled with
whitespace.  Single newlines are equivalent to a space, but blank
lines (two or more newlines in a row) are taken to mean a paragraph
break.  Formatting of comments which begin after the first column is
enabled with the ‘-fca’ option.  To format those beginning in
column one, specify ‘-fc1’.  The right margin defaults to 78, but
may be changed with the ‘-l’ option.  Such formatting is disabled
by default.

If the margin specified does not allow the comment to be printed, the
margin will be automatically extended for the duration of that
comment.  The margin is not respected if the comment is not being
formatted.

If the comment begins a line (i.e., there is no program text to its
left), it will be indented to the column it was found in unless the
comment is within a block of code.  In that case, such a comment will
be aligned with the indented code of that block.  This alignment may
be affected by the ‘-d’ option, which specifies an amount by
which such comments are moved to the left, or unindented.  For
example, ‘-d2’ places comments two spaces to the left of code.
By default, comments are aligned with code.

Comments to the right of code will appear by default in column 33.
This may be changed with one of three options.  ‘-c’ will specify
the column for comments following code, ‘-cd’ specifies the
column for comments following declarations, and ‘-cp’ specifies
the column for comments following preprocessor directives #else
and #endif.

If the code to the left of the comment exceeds the beginning column,
the comment column will be extended to the next tabstop column past
the end of the code, or in the case of preprocessor directives, to one
space past the end of the directive.  This extension lasts only for
the output of that particular comment.

The ‘-cdb’ option places the comment delimiters on blank lines.
Thus, a single line comment like /* Claustrophobia */ can be
transformed into:

/*
   Claustrophobia
 */
Stars can be placed at the beginning of multi-line comments with the
‘-sc’ option.  Thus, the single-line comment above can be
transformed (with @same{-cdb -sc}) into:

/*
 * Claustrophobia
 */
C++ comments are also handled.  A C++ comment begins with //
and ends with the newline.  The beginning column may be affected as
above with options ‘-c’, ‘-cd’, and ‘-cp’.  If
formatting is specified, indent will attempt to break C++
comment lines which exceed the margin into multiple lines.

This document was generated on March 3, 2023 using texi2html 5.0.