home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / gnu / indent-1.9.1-src.lha / src / amiga / indent-1.9.1 / indent.info < prev    next >
Encoding:
GNU Info File  |  1994-02-03  |  42.1 KB  |  1,245 lines

  1. This is Info file indent.info, produced by Makeinfo-1.54 from the input
  2. file ./indent.texinfo.
  3.  
  4.    Copyright (C) 1989, 1992, 1993, 1994 Free Software Foundation, Inc.
  5.  
  6.    This is Edition 1.3, January, 1994, of `The `indent' Manual', for
  7. Indent Version 1.9
  8.  
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.  
  13. 
  14. File: indent.info,  Node: Top,  Next: Indent Program,  Prev: (dir),  Up: (dir)
  15.  
  16. `indent':  Indent and Format C Program Source
  17. *********************************************
  18.  
  19.    The `indent' program changes the appearance of a C program by
  20. inserting or deleting whitespace.
  21.  
  22.    This is Edition 1.3, January 1994, of `The `indent' Manual', for
  23. Indent Version 1.9
  24.  
  25. * Menu:
  26.  
  27. * Indent Program::              The `indent' Program
  28. * Option Summary::              Option Summary
  29. * Index::                       Index
  30.  
  31. 
  32. File: indent.info,  Node: Indent Program,  Next: Option Summary,  Prev: Top,  Up: Top
  33.  
  34. The `indent' Program
  35. ********************
  36.  
  37.    The `indent' program can be used to make code easier to read.  It
  38. can also convert from one style of writing C to another.
  39.  
  40.    `indent' understands a substantial amount about the syntax of C, but
  41. it also attempts to cope with incomplete and misformed syntax.
  42.  
  43.    In version 1.2 and more recent versions, the GNU style of indenting
  44. is the default.
  45.  
  46. * Menu:
  47.  
  48. * Invoking indent::             Invoking `indent'
  49. * Backup files::                Backup Files
  50. * Common styles::               Common styles
  51. * Blank lines::                 Blank lines
  52. * Comments::                    Comments
  53. * Statements::                  Statements
  54. * Declarations::                Declarations
  55. * Indentation::                 Indentation
  56. * Disabling Formatting::        Disabling Formatting
  57. * Miscellaneous options::       Miscellaneous options
  58. * Bugs::                     Bugs
  59. * Copyright::                   Copyright
  60.  
  61. 
  62. File: indent.info,  Node: Invoking indent,  Next: Backup files,  Up: Indent Program
  63.  
  64. Invoking `indent'
  65. =================
  66.  
  67.    As of version 1.3, the format of the `indent' command is:
  68.  
  69.      indent [OPTIONS] [INPUT-FILES]
  70.      
  71.      indent [OPTIONS] [SINGLE-INPUT-FILE] [-o OUTPUT-FILE]
  72.  
  73.    This format is different from earlier versions and other versions of
  74. `indent'.
  75.  
  76.    In the first form, one or more input files are specified.  `indent'
  77. makes a backup copy of each file, and the original file is replaced with
  78. its indented version.  *Note Backup files::, for an explanation of how
  79. backups are made.
  80.  
  81.    In the second form, only one input file is specified.  In this case,
  82. or when the standard input is used, you may specify an output file after
  83. the `-o' option.
  84.  
  85.    To cause `indent' to write to standard output, use the `-st' option.
  86. This is only allowed when there is only one input file, or when the
  87. standard input is used.
  88.  
  89.    If no input files are named, the standard input is read for input.
  90. Also, if a filename named `-' is specified, then the standard input is
  91. read.
  92.  
  93.    As an example, each of the following commands will input the program
  94. `slithy_toves.c' and write its indented text to `slithy_toves.out':
  95.  
  96.      indent slithy_toves.c -o slithy_toves.out
  97.      
  98.      indent -st slithy_toves.c > slithy_toves.out
  99.      
  100.      cat slithy_toves.c | indent -o slithy_toves.out
  101.  
  102.    Most other options to `indent' control how programs are formatted.
  103. As of version 1.2, `indent' also recognizes a long name for each option
  104. name.  Long options are prefixed by either `--' or `+'.(1) In most of
  105. this document, the traditional, short names are used for the sake of
  106. brevity.  *Note Option Summary::, for a list of options, including both
  107. long and short names.
  108.  
  109.    Here is another example:
  110.  
  111.      indent -br test/metabolism.c -l85
  112.  
  113.    This will indent the program `test/metabolism.c' using the `-br' and
  114. `-l85' options, write the output back to `test/metabolism.c', and write
  115. the original contents of `test/metabolism.c' to a backup file in the
  116. directory `test'.
  117.  
  118.    Equivalent invocations using long option names for this example would
  119. be:
  120.  
  121.      indent --braces-on-if-line --line-length185 test/metabolism.c
  122.      
  123.      indent +braces-on-if-line +line-length185 test/metabolism.c
  124.  
  125.    If you find that you often use `indent' with the same options, you
  126. may put those options into a file called `.indent.pro'.  `indent' will
  127. first look for `.indent.pro' in the current directory and use that if
  128. found.  Otherwise, `indent' will search your home directory for
  129. `.indent.pro' and use that file if it is found.  This behaviour is
  130. different from that of other versions of `indent', which load both
  131. files if they both exist.
  132.  
  133.    Command line switches are handled *after* processing `.indent.pro'.
  134. Options specified later override arguments specified earlier, with one
  135. exception: Explicitly specified options always override background
  136. options (*note Common styles::.).  You can prevent `indent' from
  137. reading an `.indent.pro' file by specifying the `-npro' option.
  138.  
  139.    ---------- Footnotes ----------
  140.  
  141.    (1)   `+' is being superseded by `--' to maintain consistency with
  142. the POSIX standard.
  143.  
  144. 
  145. File: indent.info,  Node: Backup files,  Next: Common styles,  Prev: Invoking indent,  Up: Indent Program
  146.  
  147. Backup Files
  148. ============
  149.  
  150.    As of version 1.3, GNU `indent' makes GNU-style backup files, the
  151. same way GNU Emacs does.  This means that either "simple" or "numbered"
  152. backup filenames may be made.
  153.  
  154.    Simple backup file names are generated by appending a suffix to the
  155. original file name.  The default for the this suffix is the
  156. one-character string `~' (tilde).  Thus, the backup file for `python.c'
  157. would be `python.c~'.
  158.  
  159.    Instead of the default, you may specify any string as a suffix by
  160. setting the environment variable `SIMPLE_BACKUP_SUFFIX' to your
  161. preferred suffix.
  162.  
  163.    Numbered backup versions of a file `momewraths' look like
  164. `momewraths.c.~23~', where 23 is the version of this particular backup.
  165. When making a numbered backup of the file `src/momewrath.c', the
  166. backup file will be named `src/momewrath.c.~V~', where V is one greater
  167. than the highest version currently existing in the directory `src'.
  168.  
  169.    The type of backup file made is controlled by the value of the
  170. environment variable `VERSION_CONTROL'.  If it is the string `simple',
  171. then only simple backups will be made.  If its value is the string
  172. `numbered', then numbered backups will be made.  If its value is
  173. `numbered-existing', then numbered backups will be made if there
  174. *already exist* numbered backups for the file being indented;
  175. otherwise, a simple backup is made.  If `VERSION_CONTROL' is not set,
  176. then `indent' assumes the behaviour of `numbered-existing'.
  177.  
  178.    Other versions of `indent' use the suffix `.BAK' in naming backup
  179. files.  This behaviour can be emulated by setting
  180. `SIMPLE_BACKUP_SUFFIX' to `.BAK'.
  181.  
  182.    Note also that other versions of `indent' make backups in the
  183. current directory, rather than in the directory of the source file as
  184. GNU `indent' now does.
  185.  
  186. 
  187. File: indent.info,  Node: Common styles,  Next: Blank lines,  Prev: Backup files,  Up: Indent Program
  188.  
  189. Common styles
  190. =============
  191.  
  192.    There are several common styles of C code, including the GNU style,
  193. the Kernighan & Ritchie style, and the original Berkeley style.  A
  194. style may be selected with a single "background" option, which
  195. specifies a set of values for all other options.  However, explicitly
  196. specified options always override options implied by a background
  197. option.
  198.  
  199.    As of version 1.2, the default style of GNU `indent' is the GNU
  200. style.  Thus, it is no longer neccessary to specify the option `-gnu'
  201. to obtain this format, although doing so will not cause an error.
  202. Option settings which correspond to the GNU style are:
  203.  
  204.      -nbad -bap -nbc -bl -bli2 -c33 -cd33 -ncdb -nce -cli0
  205.      -cp1 -di2 -nfc1 -nfca -i2 -ip5 -lp -pcs -psl -cs
  206.      -nsc -nsob -nss -ts8 -d0 -ci0 -l78
  207.  
  208.    The GNU coding style is that preferred by the GNU project.  It is the
  209. style that the GNU Emacs C mode encourages and which is used in the C
  210. portions of GNU Emacs.  (People interested in writing programs for
  211. Project GNU should get a copy of `The GNU Coding Standards', which also
  212. covers semantic and portability issues such as memory usage, the size
  213. of integers, etc.)
  214.  
  215.    The Kernighan & Ritchie style is used throughout their well-known
  216. book `The C Programming Language'.  It is enabled with the `-kr'
  217. option.  The Kernighan & Ritchie style corresponds to the following set
  218. of options:
  219.  
  220.      -nbad -bap -nbc -br -c33 -cd33 -ncdb -ce -ci4
  221.      -cli0 -cp33 -d0 -di1 -nfc1 -nfca -i4 -ip0 -l75 -lp
  222.      -npcs -npsl -nsc -nsob -nss -ts8 -cs
  223.  
  224. Kernighan & Ritchie style does not put comments to the right of code in
  225. the same column at all times (nor does it use only one space to the
  226. right of the code), so for this style `indent' has arbitrarily chosen
  227. column 33.
  228.  
  229.    The style of the original Berkeley `indent' may be obtained by
  230. specifying `-orig' (or by specifyfying `--original', using the long
  231. option name).  This style is equivalent to the following settings:
  232.  
  233.      -nbap -nbad -bc -br -c33 -cd33 -cdb -ce -ci4
  234.      -cli0 -cp33 -d4 -di16 -fc1 -fca -i4 -ip4 -l75 -lp
  235.      -npcs -psl -sc -nsob -nss -ts8 -ncs
  236.  
  237. 
  238. File: indent.info,  Node: Blank lines,  Next: Comments,  Prev: Common styles,  Up: Indent Program
  239.  
  240. Blank lines
  241. ===========
  242.  
  243.    Various programming styles use blank lines in different places.
  244. `indent' has a number of options to insert or delete blank lines in
  245. specific places.
  246.  
  247.    The `-bad' option causes `indent' to force a blank line after every
  248. block of declarations.  The `-nbad' option causes `indent' not to force
  249. such blank lines.
  250.  
  251.    The `-bap' option forces a blank line after every procedure body.
  252. The `-nbap' option forces no such blank line.
  253.  
  254.    The `-sob' option causes `indent' to swallow optional blank lines
  255. (that is, any optional blank lines present in the input will be removed
  256. from the output).  If the `-nsob' is specified, any blank lines present
  257. in the input file will be copied to the output file.
  258.  
  259. * Menu:
  260.  
  261. * -bad::                        More on the `-bad' option.
  262. * -bap::                        More on the `-bap' option.
  263.  
  264. 
  265. File: indent.info,  Node: -bad,  Next: -bap,  Up: Blank lines
  266.  
  267. -blank-lines-after-declarations
  268. -------------------------------
  269.  
  270.    The `-bad' option forces a blank line after every block of
  271. declarations.  The `-nbad' option does not add any such blank lines.
  272.  
  273.    For example, given the input
  274.      char *foo;
  275.      char *bar;
  276.      /* This separates blocks of declarations.  */
  277.      int baz;
  278.  
  279. `indent -bad' produces
  280.  
  281.      char *foo;
  282.      char *bar;
  283.      
  284.      /* This separates blocks of declarations.  */
  285.      int baz;
  286.  
  287. and `indent -nbad' produces
  288.  
  289.      char *foo;
  290.      char *bar;
  291.      /* This separates blocks of declarations.  */
  292.      int baz;
  293.  
  294. 
  295. File: indent.info,  Node: -bap,  Prev: -bad,  Up: Blank lines
  296.  
  297. -blank-lines-after-procedures
  298. -----------------------------
  299.  
  300.    The `-bap' option forces a blank line after every procedure body.
  301.  
  302.    For example, given the input
  303.  
  304.      int
  305.      foo ()
  306.      {
  307.        puts("Hi");
  308.      }
  309.      /* The procedure bar is even less interesting.  */
  310.      char *
  311.      bar ()
  312.      {
  313.        puts("Hello");
  314.      }
  315.  
  316. `indent -bap' produces
  317.  
  318.      int
  319.      foo ()
  320.      {
  321.        puts ("Hi");
  322.      }
  323.      
  324.      /* The procedure bar is even less interesting.  */
  325.      char *
  326.      bar ()
  327.      {
  328.        puts ("Hello");
  329.      }
  330.  
  331. and `indent -nbap' produces
  332.  
  333.      int
  334.      foo ()
  335.      {
  336.        puts ("Hi");
  337.      }
  338.      /* The procedure bar is even less interesting.  */
  339.      char *
  340.      bar ()
  341.      {
  342.        puts ("Hello");
  343.      }
  344.  
  345. No blank line will be added after the procedure `foo'.
  346.  
  347. 
  348. File: indent.info,  Node: Comments,  Next: Statements,  Prev: Blank lines,  Up: Indent Program
  349.  
  350. Comments
  351. ========
  352.  
  353.    `indent' formats both C and C++ comments. C comments are begun with
  354. `/*' and terminated with `*/' and may contain newline characters.  C++
  355. comments begin with the delimiter `//' and end at the newline.
  356.  
  357.    `indent' handles comments differently depending upon their context.
  358. `indent' attempts to distinguish amongst comments which follow
  359. statements, comments which follow declarations, comments following
  360. preprocessor directives, and comments which are not preceded by code of
  361. any sort, i.e., they begin the text of the line (although not
  362. neccessarily in column 1).
  363.  
  364.    `indent' further attempts to leave "boxed comments" unmodified.  The
  365. general idea of such a comment is that it is enclosed in a rectangle or
  366. "box" of stars or dashes to visually set it apart.  More precisely,
  367. boxed comments are defined as those in which the initial `/*' is
  368. followed immediately by the character `*', `=', `_', or `-', or those
  369. in which the beginning comment delimiter (`/*') is on a line by itself,
  370. and the following line begins with a `*' in the same column as the star
  371. of the opening delimiter.
  372.  
  373.    Examples of boxed comments are:
  374.  
  375.      /**********************
  376.       * Comment in a box!! *
  377.       **********************/
  378.      
  379.             /*
  380.              * A different kind of scent,
  381.              * for a different kind of comment.
  382.              */
  383.  
  384.    `indent' attempts to leave boxed comments exactly as they are found
  385. in the source file.  Thus the indentation of the comment is unchanged,
  386. and its length is not checked in any way.  The only alteration made is
  387. that an embedded tab character may be converted into the appropriate
  388. number of spaces.
  389.  
  390.    Comments which are not boxed may be formatted, which means that the
  391. line is broken to fit within a right margin and left-filled with
  392. whitespace.  Single newlines are equivalent to a space, but blank lines
  393. (two or more newlines in a row) are taken to mean a paragraph break.
  394. Formatting of comments which begin after the first column is enabled
  395. with the `-fca' option.  To format those beginning in column one,
  396. specify `-fc1'.  Such formatting is disabled by default.
  397.  
  398.    The right margin for formatting defaults to 78, but may be changed
  399. with the `-lc' or the `-l' option.  `-l' specifies the right margin for
  400. all code, and `-lc' specifies the margin for only for comments.  If
  401. `-l' is used alone, comments will be formatted according to the margin
  402. specified with that option.
  403.  
  404.    If the margin specified does not allow the comment to be printed, the
  405. margin will be automatically extended for the duration of that comment.
  406. The margin is not respected if the comment is not being formatted.
  407.  
  408.    If the comment begins a line (i.e., there is no program text to its
  409. left), it will be indented to the column it was found in unless the
  410. comment is within a block of code.  In that case, such a comment will
  411. be aligned with the indented code of that block.  This alignment may be
  412. affected by the `-d' option, which specifies an amount by which such
  413. comments are moved to the *left*, or unindented.  For example, `-d2'
  414. places comments two spaces to the left of code.  By default, comments
  415. are aligned with code.
  416.  
  417.    Comments to the right of code will appear by default in column 33.
  418. This may be changed with one of three options.  `-c' will specify the
  419. column for comments following code, `-cd' specifies the column for
  420. comments following declarations, and `-cp' specifies the column for
  421. comments following preprocessor directives `#else' and `#endif'.
  422.  
  423.    If the code to the left of the comment exceeds the beginning column,
  424. the comment column will be extended to the next tabstop column past the
  425. end of the code, or in the case of preprocessor directives, to one
  426. space past the end of the directive.  This extension lasts only for the
  427. output of that particular comment.
  428.  
  429.    The `-cdb' option places the comment delimiters on blank lines.
  430. Thus, a single line comment like `/* Claustrophobia */' can be
  431. transformed into:
  432.  
  433.      /*
  434.         Claustrophobia
  435.       */
  436.  
  437.    Stars can be placed at the beginning of multi-line comments with the
  438. `-sc' option.  Thus, the single-line comment above can be transformed
  439. (with `-cdb -sc') into:
  440.  
  441.      /*
  442.       * Claustrophobia
  443.       */
  444.  
  445. 
  446. File: indent.info,  Node: Statements,  Next: Declarations,  Prev: Comments,  Up: Indent Program
  447.  
  448. Statements
  449. ==========
  450.  
  451.    The `-br' or `-bl' option specifies how to format braces.
  452.  
  453.    The `-br' option formats statement braces like this:
  454.  
  455.      if (x > 0) {
  456.        x--;
  457.      }
  458.  
  459. The `-bl' option formats them like this:
  460.  
  461.      if (x > 0)
  462.        {
  463.          x--;
  464.        }
  465.  
  466.    These options also affect structure and enumeration declarations.
  467. The `-br' option produces structure declarations like the following:
  468.  
  469.      struct Sname {
  470.          int i;
  471.          char chp;
  472.      } Vname;
  473.  
  474.    The default behaviour, also obtained by specifying `-bl', would
  475. yield the following format for the same declaration:
  476.  
  477.      struct Sname
  478.        {
  479.           int i;
  480.           char chp;
  481.        }
  482.      Vname;
  483.  
  484.    If you use the `-bl' option, you may also want to specify the `-bli'
  485. option.  This option specifies the number of spaces by which braces are
  486. indented.  `-bli2', the default, gives the result shown above.  `-bli0'
  487. results in the following:
  488.  
  489.      if (x > 0)
  490.      {
  491.        x--;
  492.      }
  493.  
  494.    If you are using the `-br' option, you probably want to also use the
  495. `-ce' option.  This causes the `else' in an if-then-else construct to
  496. cuddle up to the immediately preceding `}'.  For example, with `-br
  497. -ce' you get the following:
  498.  
  499.      if (x > 0) {
  500.        x--;
  501.      } else {
  502.        fprintf (stderr, "...something wrong?\n");
  503.      }
  504.  
  505. With `-br -nce' that code would appear as
  506.  
  507.      if (x > 0) {
  508.        x--;
  509.      }
  510.      else {
  511.        fprintf (stderr, "...something wrong?\n");
  512.      }
  513.  
  514.    The `-cli' option specifies the number of spaces that case labels
  515. should be indented to the right of the containing `switch' statement.
  516.  
  517.    If a semicolon is on the same line as a `for' or `while' statement,
  518. the `-ss' option will cause a space to be placed before the semicolon.
  519. This emphasizes the semicolon, making it clear that the body of the
  520. `for' or `while' statement is an empty statement.  `-nss' disables this
  521. feature.
  522.  
  523.    The `-pcs' option causes a space to be placed between the name of
  524. the procedure being called and the `(' (for example, `puts ("Hi");'.
  525. The `-npcs' option would give `puts("Hi");').
  526.  
  527.    If the `-cs' option is specified, `indent' puts a space after a cast
  528. operator.
  529.  
  530.    The `-bs' option ensures that there is a space between the keyword
  531. `sizeof' and its argument.  In some versions, this is known as the
  532. `Bill_Shannon' option.
  533.  
  534. 
  535. File: indent.info,  Node: Declarations,  Next: Indentation,  Prev: Statements,  Up: Indent Program
  536.  
  537. Declarations
  538. ============
  539.  
  540.    By default `indent' will line up identifiers, in the column
  541. specified by the `-di' option.  For example, `-di16' makes things look
  542. like:
  543.  
  544.      int             foo;
  545.      char           *bar;
  546.  
  547.    Using a small value (such as one or two) for the `-di' option can be
  548. used to cause the indentifiers to be placed in the first available
  549. position, for example
  550.  
  551.      int foo;
  552.      char *bar;
  553.  
  554.    The value given to the `-di' option will still affect variables
  555. which are put on separate lines from their types, for example `-di2'
  556. will lead to
  557.  
  558.      int
  559.        foo;
  560.  
  561.    If the `-bc' option is specified, a newline is forced after each
  562. comma in a declaration.  For example,
  563.  
  564.      int a,
  565.        b,
  566.        c;
  567.  
  568. With the `-nbc' option this would look like
  569.  
  570.      int a, b, c;
  571.  
  572.    The `-psl' option causes the type of a procedure being defined to be
  573. placed on the line before the name of the procedure.  This style is
  574. required for the `etags' program to work correctly, as well as some of
  575. the `c-mode' functions of Emacs.
  576.  
  577.    If you are not using the `-di1' option to place variables being
  578. declared immediately after their type, you need to use the `-T' option
  579. to tell `indent' the name of all the typenames in your program that are
  580. defined by `typedef'.  `-T' can be specified more than once, and all
  581. names specified are used.  For example, if your program contains
  582.  
  583.      typedef unsigned long CODE_ADDR;
  584.      typedef enum {red, blue, green} COLOR;
  585.  
  586. you would use the options `-T CODE_ADDR -T COLOR'.
  587.  
  588. 
  589. File: indent.info,  Node: Indentation,  Next: Disabling Formatting,  Prev: Declarations,  Up: Indent Program
  590.  
  591. Indentation
  592. ===========
  593.  
  594.    One issue in the formatting of code is how far each line should be
  595. indented from the left margin.  When the beginning of a statement such
  596. as `if' or `for' is encountered, the indentation level is increased by
  597. the value specified by the `-i' option.  For example, use `-i8' to
  598. specify an eight character indentation for each level.  When a
  599. statement is broken across two lines, the second line is indented by a
  600. number of additional spaces specified by the `-ci' option.  `-ci'
  601. defaults to 0.  However, if the `-lp' option is specified, and a line
  602. has a left parenthesis which is not closed on that line, then
  603. continuation lines will be lined up to start at the character position
  604. just after the left parenthesis.  This processing also applies to `['
  605. and applies to `{' when it occurs in initialization lists.  For
  606. example, a piece of continued code might look like this with `-nlp
  607. -ci3' in effect:
  608.  
  609.        p1 = first_procedure (second_procedure (p2, p3),
  610.           third_procedure (p4, p5));
  611.  
  612. With `-lp' in effect the code looks somewhat clearer:
  613.  
  614.        p1 = first_procedure (second_procedure (p2, p3),
  615.                              third_procedure (p4, p5));
  616.  
  617.    `indent' assumes that tabs are placed at regular intervals of both
  618. input and output character streams.  These intervals are by default 8
  619. columns wide, but (as of version 1.2) may be changed by the `-ts'
  620. option.  Tabs are treated as the equivalent number of spaces.
  621.  
  622.    The indentation of type declarations in old-style function
  623. definitions is controlled by the `-ip' parameter.  This is a numeric
  624. parameter specifying how many spaces to indent type declarations.  For
  625. example, the default `-ip5' makes definitions look like this:
  626.  
  627.      char *
  628.      create_world (x, y, scale)
  629.           int x;
  630.           int y;
  631.           float scale;
  632.      {
  633.        . . .
  634.      }
  635.  
  636.    For compatibility with other versions of indent, the option `-nip'
  637. is provided, which is equivalent to `-ip0'.
  638.  
  639.    ASCII C allows white space to be placed on preprocessor command lines
  640. between the character `#' and the command name.  By default, `indent'
  641. removes this space, but specifying the `-lps' option directs `indent'
  642. to leave this space unmodified.
  643.  
  644. 
  645. File: indent.info,  Node: Disabling Formatting,  Next: Miscellaneous options,  Prev: Indentation,  Up: Indent Program
  646.  
  647. Disabling Formatting
  648. ====================
  649.  
  650.    Formatting of C code may be disabled for portions of a program by
  651. embedding special "control comments" in the program.  To turn off
  652. formatting for a section of a program, place the disabling control
  653. comment `/* *INDENT-OFF* */' on a line by itself just before that
  654. section.  Program text scanned after this control comment is output
  655. precisely as input with no modifications until the corresponding
  656. enabling comment is scanned on a line by itself.  The disabling control
  657. comment is `/* *INDENT-ON* */', and any text following the comment on
  658. the line is also output unformatted.  Formatting begins again with the
  659. input line following the enabling control comment.
  660.  
  661.    More precisely, `indent' does not attempt to verify the closing
  662. delimiter (`*/') for these C comments, and any whitespace on the line
  663. is totally transparent.
  664.  
  665.    These control comments also function in their C++ formats, namely
  666. `// *INDENT-OFF*' and `// *INDENT-ON*'.
  667.  
  668.    It should be noted that the internal state of `indent' remains
  669. unchanged over the course of the unformatted section.  Thus, for
  670. example, turning off formatting in the middle of a function and
  671. continuing it after the end of the function may lead to bizarre
  672. results.  It is therefore wise to be somewhat modular in selecting code
  673. to be left unformatted.
  674.  
  675.    As a historical note, some earlier versions of `indent' produced
  676. error messages beginning with `*INDENT**'.  These versions of `indent'
  677. were written to ignore any input text lines which began with such error
  678. messages.  I have removed this incestuous feature from `GNU indent'.
  679.  
  680. 
  681. File: indent.info,  Node: Miscellaneous options,  Next: Bugs,  Prev: Disabling Formatting,  Up: Indent Program
  682.  
  683. Miscellaneous options
  684. =====================
  685.  
  686.    To find out what version of `indent' you have, use the command
  687. `indent -version'.  This will report the version number of `indent',
  688. without doing any of the normal processing.
  689.  
  690.    The `-v' option can be used to turn on verbose mode.  When in
  691. verbose mode, `indent' reports when it splits one line of input into
  692. two more more lines of output, and gives some size statistics at
  693. completion.
  694.  
  695. 
  696. File: indent.info,  Node: Bugs,  Next: Copyright,  Prev: Miscellaneous options,  Up: Indent Program
  697.  
  698. Bugs
  699. ====
  700.  
  701.    The "-troff" option is strongly deprecated, and is not supported.  A
  702. good thing for someone to do is to rewrite `indent' to generate TeX
  703. source as a hardcopy output option, amoung other things.
  704.  
  705. 
  706. File: indent.info,  Node: Copyright,  Prev: Bugs,  Up: Indent Program
  707.  
  708. Copyright
  709. =========
  710.  
  711.    The following copyright notice applies to the `indent' program.  The
  712. copyright and copying permissions for this manual appear near the
  713. beginning of this document.
  714.  
  715.      Copyright (c) 1989, 1992 Free Software Foundation
  716.      Copyright (c) 1985 Sun Microsystems, Inc.
  717.      Copyright (c) 1980 The Regents of the University of California.
  718.      Copyright (c) 1976 Board of Trustees of the University of Illinois.
  719.      All rights reserved.
  720.      
  721.      Redistribution and use in source and binary forms are permitted
  722.      provided that the above copyright notice and this paragraph are
  723.      duplicated in all such forms and that any documentation,
  724.      advertising materials, and other materials related to such
  725.      distribution and use acknowledge that the software was developed
  726.      by the University of California, Berkeley, the University of Illinois,
  727.      Urbana, and Sun Microsystems, Inc.  The name of either University
  728.      or Sun Microsystems may not be used to endorse or promote products
  729.      derived from this software without specific prior written permission.
  730.      THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  731.      IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  732.      WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  733.      PURPOSE.
  734.  
  735. 
  736. File: indent.info,  Node: Option Summary,  Next: Index,  Prev: Indent Program,  Up: Top
  737.  
  738. Option Summary
  739. **************
  740.  
  741.    Here is a list of all the options for `indent', alphabetized by
  742. short option.  It is followed by a cross key alphabetized by long
  743. option.
  744.  
  745. `-bad'
  746. `--blank-lines-after-declarations'
  747.      Force blank lines after the declarations.
  748.      *Note Blank lines::.
  749.  
  750. `-bap'
  751. `--blank-lines-after-procedures'
  752.      Force blank lines after procedure bodies.
  753.      *Note Blank lines::.
  754.  
  755. `-bbb'
  756. `--blank-lines-after-block-comments'
  757.      Force blank lines after block comments.
  758.      *Note Blank lines::.
  759.  
  760. `-bc'
  761. `--blank-lines-after-commas'
  762.      Force newline after comma in declaration.
  763.      *Note Declarations::.
  764.  
  765. `-bl'
  766. `--braces-after-if-line'
  767.      Put braces on line after `if', etc.
  768.      *Note Statements::.
  769.  
  770. `-bliN'
  771. `--brace-indentN'
  772.      Indent braces N spaces.
  773.      *Note Statements::.
  774.  
  775. `-br'
  776. `--braces-on-if-line'
  777.      Put braces on line with `if', etc. and structure declarations
  778.      *Note Statements::.
  779.  
  780. `-cN'
  781. `--comment-indentationN'
  782.      Put comments to the right of code in column N.
  783.      *Note Comments::.
  784.  
  785. `-cdN'
  786. `--declaration-comment-columnN'
  787.      Put comments to the right of the declarations in column N.
  788.      *Note Comments::.
  789.  
  790. `-cdb'
  791. `--comment-delimiters-on-blank-lines'
  792.      Put comment delimiters on blank lines.
  793.      *Note Comments::.
  794.  
  795. `-ce'
  796. `--cuddle-else'
  797.      Cuddle else and preceeding `}'.
  798.      *Note Comments::.
  799.  
  800. `-ciN'
  801. `--continuation-indentationN'
  802.      Continuation indent of N spaces.
  803.      *Note Statements::.
  804.  
  805. `-cliN'
  806. `--case-indentationN'
  807.      Case label indent of N spaces.
  808.      *Note Statements::.
  809.  
  810. `-cpN'
  811. `--else-endif-columnN'
  812.      Put comments to the right of `#else' and `#endif' statements in
  813.      column N.
  814.      *Note Comments::.
  815.  
  816. `-cs'
  817. `--space-after-cast'
  818.      Put a space after a cast operator.
  819.      *Note Statements::.
  820.  
  821. `-bs'
  822. `--blank-before-sizeof'
  823.      Put a space between `sizeof' and its argument.
  824.      *Note Statements::
  825.  
  826. `-dN'
  827. `--line-comments-indentationN'
  828.      Set indentation of comments not to the right of code to N spaces.
  829.      *Note Comments::.
  830.  
  831. `-diN'
  832. `--declaration-indentationN'
  833.      Put variables in column N.
  834.      *Note Declarations::.
  835.  
  836. `-fc1'
  837. `--format-first-column-comments'
  838.      Format comments in the first column.
  839.      *Note Comments::.
  840.  
  841. `-fca'
  842. `--format-all-comments'
  843.      Do not disable all formatting of comments.
  844.      *Note Comments::
  845.  
  846. `-gnu'
  847. `--gnu-style'
  848.      Use GNU coding style.  This is the default.
  849.      *Note Common styles::.
  850.  
  851. `-iN'
  852. `--indent-levelN'
  853.      Set indentation level to N spaces.
  854.      *Note Indentation::.
  855.  
  856. `-ipN'
  857. `--parameter-indentationN'
  858.      Indent parameter types in old-style function definitions by N
  859.      spaces.
  860.      *Note Indentation::.
  861.  
  862. `-kr'
  863. `--k-and-r-style'
  864.      Use Kernighan & Ritchie coding style.
  865.      *Note Common styles::.
  866.  
  867. `-lN'
  868. `--line-lengthN'
  869.      Set maximum line length to N.
  870.      *Note Comments::.
  871.  
  872. `-lcN'
  873. `--comment-line-lengthN'
  874.      Set maximum line length for comment formatting to N.
  875.      *Note Comments::.
  876.  
  877. `-lp'
  878. `--continue-at-parentheses'
  879.      Line up continued lines at parentheses.
  880.      *Note Indentation::.
  881.  
  882. `-lps'
  883. `--leave-preprocessor-space'
  884.      Leave space between `#' and preprocessor directive.  *Note
  885.      Indentation::.
  886.  
  887. `-nbad'
  888. `--no-blank-lines-after-declarations'
  889.      Do not force blank lines after declarations.
  890.      *Note Blank lines::.
  891.  
  892. `-nbap'
  893. `--no-blank-lines-after-procedures'
  894.      Do not force blank lines after procedure bodies.
  895.      *Note Blank lines::.
  896.  
  897. `-nbc'
  898. `--no-blank-lines-after-commas'
  899.      Do not force newlines after commas in declarations.
  900.      *Note Declarations::.
  901.  
  902. `-ncdb'
  903. `--no-comment-delimiters-on-blank-lines'
  904.      Do not put comment delimiters on blank lines.
  905.      *Note Comments::.
  906.  
  907. `-nce'
  908. `--dont-cuddle-else'
  909.      Do not cuddle `}' and `else'.
  910.      *Note Statements::.
  911.  
  912. `-ncs'
  913. `--no-space-after-casts'
  914.      Do not put a space after cast operators.
  915.      *Note Statements::.
  916.  
  917. `-nfc1'
  918. `--dont-format-first-column-comments'
  919.      Do not format comments in the first column as normal.
  920.      *Note Comments::.
  921.  
  922. `-nfca'
  923. `--dont-format-comments'
  924.      Do not format any comments.
  925.      *Note Comments::.
  926.  
  927. `-nip'
  928. `--no-parameter-indentation'
  929.      Zero width indentation for parameters.
  930.      *Note Indentation::
  931.  
  932. `-nlp'
  933. `--dont-line-up-parentheses'
  934.      Do not line up parentheses.
  935.      *Note Statements::.
  936.  
  937. `-npcs'
  938. `--no-space-after-function-call-names'
  939.      Do not put space after the function in function calls.
  940.      *Note Statements::.
  941.  
  942. `-npsl'
  943. `--dont-break-procedure-type'
  944.      Put the type of a procedure on the same line as its name.
  945.      *Note Declarations::.
  946.  
  947. `-nsc'
  948. `--dont-star-comments'
  949.      Do not put the `*' character at the left of comments.
  950.      *Note Comments::.
  951.  
  952. `-nsob'
  953. `--leave-optional-blank-lines'
  954.      Do not swallow optional blank lines.
  955.      *Note Blank lines::.
  956.  
  957. `-nss'
  958. `--dont-space-special-semicolon'
  959.      Do not force a space before the semicolon after certain statements.
  960.      Disables `-ss'.
  961.      *Note Statements::.
  962.  
  963. `-nv'
  964. `--no-verbosity'
  965.      Disable verbose mode. *Note Miscellaneous options::.
  966.  
  967. `-orig'
  968. `--original'
  969.      Use the original Berkeley coding style.
  970.      *Note Common styles::.
  971.  
  972. `-npro'
  973. `--ignore-profile'
  974.      Do not read `.indent.pro' files.
  975.      *Note Invoking indent::.
  976.  
  977. `-pcs'
  978. `--space-after-procedure-calls'
  979.      Insert a space between the name of the procedure being called and
  980.      the `('.
  981.      *Note Statements::.
  982.  
  983. `-psl'
  984. `--procnames-start-lines'
  985.      Put the type of a procedure on the line before its name.
  986.      *Note Declarations::.
  987.  
  988. `-sc'
  989. `--start-left-side-of-comments'
  990.      Put the `*' character at the left of comments.
  991.      *Note Comments::.
  992.  
  993. `-sob'
  994. `--swallow-optional-blank-lines'
  995.      Swallow optional blank lines.
  996.      *Note Blank lines::.
  997.  
  998. `-ss'
  999. `--space-special-semicolon'
  1000.      On one-line `for' and `while' statments, force a blank before the
  1001.      semicolon.
  1002.      *Note Statements::.
  1003.  
  1004. `-st'
  1005. `--standard-output'
  1006.      Write to standard output.
  1007.      *Note Invoking indent::.
  1008.  
  1009. `-T'
  1010.      Tell `indent' the name of typenames.
  1011.      *Note Declarations::.
  1012.  
  1013. `-tsN'
  1014. `--tab-sizeN'
  1015.      Set tab size to N spaces.
  1016.      *Note Indentation::.
  1017.  
  1018. `-v'
  1019. `--verbose'
  1020.      Enable verbose mode.
  1021.      *Note Miscellaneous options::.
  1022.  
  1023. `-version'
  1024.      Output the version number of `indent'.
  1025.      *Note Miscellaneous options::.
  1026.  
  1027. Options' Cross Key
  1028. ------------------
  1029.  
  1030.    Here is a list of options alphabetized by long option, to help you
  1031. find the corresponding short option.
  1032.  
  1033.      --blank-lines-after-block-comments              -bbb
  1034.      --blank-lines-after-commas                      -bc
  1035.      --blank-lines-after-declarations                -bad
  1036.      --blank-lines-after-procedures                  -bap
  1037.      --braces-after-if-line                          -bl
  1038.      --brace-indent                                  -bli
  1039.      --braces-on-if-line                             -br
  1040.      --case-indentation                              -cliN
  1041.      --comment-delimiters-on-blank-lines             -cdb
  1042.      --comment-indentation                           -cN
  1043.      --continuation-indentation                      -ciN
  1044.      --continue-at-parentheses                       -lp
  1045.      --cuddle-else                                   -ce
  1046.      --declaration-comment-column                    -cdN
  1047.      --declaration-indentation                       -diN
  1048.      --dont-break-procedure-type                     -npsl
  1049.      --dont-cuddle-else                              -nce
  1050.      --dont-format-comments                          -nfca
  1051.      --dont-format-first-column-comments             -nfc1
  1052.      --dont-line-up-parentheses                      -nlp
  1053.      --dont-space-special-semicolon                  -nss
  1054.      --dont-star-comments                            -nsc
  1055.      --else-endif-column                             -cpN
  1056.      --format-all-comments                           -fca
  1057.      --format-first-column-comments                  -fc1
  1058.      --gnu-style                                     -gnu
  1059.      --ignore-profile                                -npro
  1060.      --indent-level                                  -iN
  1061.      --k-and-r-style                                 -kr
  1062.      --leave-optional-blank-lines                    -nsob
  1063.      --leave-preprocessor-space                      -lps
  1064.      --line-comments-indentation                     -dN
  1065.      --line-length                                   -lN
  1066.      --no-blank-lines-after-commas                   -nbc
  1067.      --no-blank-lines-after-declarations             -nbad
  1068.      --no-blank-lines-after-procedures               -nbap
  1069.      --no-comment-delimiters-on-blank-lines          -ncdb
  1070.      --no-space-after-casts                          -ncs
  1071.      --no-parameter-indentation                      -nip
  1072.      --no-space-after-function-call-names            -npcs
  1073.      --no-verbosity                                  -nv
  1074.      --original                                      -orig
  1075.      --parameter-indentation                         -ipN
  1076.      --procnames-start-lines                         -psl
  1077.      --space-after-cast                              -cs
  1078.      --space-after-procedure-calls                   -pcs
  1079.      --space-special-semicolon                       -ss
  1080.      --standard-output                               -st
  1081.      --start-left-side-of-comments                   -sc
  1082.      --swallow-optional-blank-lines                  -sob
  1083.      --tab-size                                      -tsN
  1084.      --verbose                                       -v
  1085.  
  1086. 
  1087. File: indent.info,  Node: Index,  Prev: Option Summary,  Up: Top
  1088.  
  1089. Index
  1090. *****
  1091.  
  1092. * Menu:
  1093.  
  1094. * -blank-after-sizeof:                  Statements.
  1095. * -blank-lines-after-commas:            Declarations.
  1096. * -blank-lines-after-declarations:      -bad.
  1097. * -blank-lines-after-procedures:        -bap.
  1098. * -brace-indentN:                       Statements.
  1099. * -braces-after-if-line:                Statements.
  1100. * -braces-on-if-line:                   Statements.
  1101. * -case-indentationN:                   Statements.
  1102. * -comment-delimiters-on-blank-lines:   Comments.
  1103. * -comment-indentationN:                Comments.
  1104. * -continuation-indentationN:           Indentation.
  1105. * -continue-at-parentheses:             Indentation.
  1106. * -cuddle-else:                         Statements.
  1107. * -declaration-comment-columnN:         Comments.
  1108. * -declaration-indentationN:            Declarations.
  1109. * -dont-break-procedure-type:           Declarations.
  1110. * -dont-cuddle-else:                    Statements.
  1111. * -dont-format-comments:                Comments.
  1112. * -dont-format-first-column-comments:   Comments.
  1113. * -dont-line-up-parentheses:            Indentation.
  1114. * -dont-space-special-semicolon:        Statements.
  1115. * -dont-star-comments:                  Comments.
  1116. * -else-endif-columnN:                  Comments.
  1117. * -format-all-comments:                 Comments.
  1118. * -format-first-column-comments:        Comments.
  1119. * -gnu-style:                           Common styles.
  1120. * -ignore-profile:                      Invoking indent.
  1121. * -indent-levelN:                       Indentation.
  1122. * -k-and-r-style:                       Common styles.
  1123. * -leave-optional-blank-lines:          Blank lines.
  1124. * -leave-preprocessor-space:            Indentation.
  1125. * -line-comments-indentationN:          Comments.
  1126. * -line-lengthN:                        Comments.
  1127. * -no-blank-lines-after-commas:         Declarations.
  1128. * -no-blank-lines-after-declarations:   -bad.
  1129. * -no-blank-lines-after-procedures:     -bap.
  1130. * -no-comment-delimiters-on-blank-lines: Comments.
  1131. * -no-parameter-indentation:            Indentation.
  1132. * -no-space-after-casts:                Statements.
  1133. * -no-space-after-function-call-names:  Statements.
  1134. * -no-verbosity:                        Miscellaneous options.
  1135. * -original:                            Common styles.
  1136. * -output-file:                         Invoking indent.
  1137. * -parameter-indentationN:              Indentation.
  1138. * -procnames-start-lines:               Declarations.
  1139. * -remove-preprocessor-space:           Indentation.
  1140. * -space-after-cast:                    Statements.
  1141. * -space-after-procedure-calls:         Statements.
  1142. * -space-special-semicolon:             Statements.
  1143. * -standard-output:                     Invoking indent.
  1144. * -star-left-side-of-comments:          Comments.
  1145. * -swallow-optional-blank-lines:        Blank lines.
  1146. * -tab-sizeN:                           Indentation.
  1147. * -verbose:                             Miscellaneous options.
  1148. * -bad:                                 -bad.
  1149. * -bap:                                 -bap.
  1150. * -bc:                                  Declarations.
  1151. * -bl:                                  Statements.
  1152. * -bliN:                                Statements.
  1153. * -br:                                  Statements.
  1154. * -bs:                                  Statements.
  1155. * -cN:                                  Comments.
  1156. * -cdN:                                 Comments.
  1157. * -cdb:                                 Comments.
  1158. * -ce:                                  Statements.
  1159. * -ciN:                                 Indentation.
  1160. * -cliN:                                Statements.
  1161. * -cpN:                                 Comments.
  1162. * -cs:                                  Statements.
  1163. * -dN:                                  Comments.
  1164. * -dce:                                 Statements.
  1165. * -diN:                                 Declarations.
  1166. * -fc1:                                 Comments.
  1167. * -fca:                                 Comments.
  1168. * -gnu:                                 Common styles.
  1169. * -iN:                                  Indentation.
  1170. * -ipN:                                 Indentation.
  1171. * -kr:                                  Common styles.
  1172. * -lN:                                  Comments.
  1173. * -lp:                                  Indentation.
  1174. * -lps:                                 Indentation.
  1175. * -nbad:                                -bad.
  1176. * -nbap:                                -bap.
  1177. * -nbc:                                 Declarations.
  1178. * -ncdb:                                Comments.
  1179. * -ncs:                                 Statements.
  1180. * -nfc1:                                Comments.
  1181. * -nfca:                                Comments.
  1182. * -nip:                                 Indentation.
  1183. * -nlp:                                 Indentation.
  1184. * -nlps:                                Indentation.
  1185. * -npcs:                                Statements.
  1186. * -npro:                                Invoking indent.
  1187. * -npsl:                                Declarations.
  1188. * -nsc:                                 Comments.
  1189. * -nsob:                                Blank lines.
  1190. * -nss:                                 Statements.
  1191. * -nv:                                  Miscellaneous options.
  1192. * -o:                                   Invoking indent.
  1193. * -orig:                                Common styles.
  1194. * -pcs:                                 Statements.
  1195. * -psl:                                 Declarations.
  1196. * -sc:                                  Comments.
  1197. * -sob:                                 Blank lines.
  1198. * -ss:                                  Statements.
  1199. * -st:                                  Invoking indent.
  1200. * -T:                                   Declarations.
  1201. * -tsN:                                 Indentation.
  1202. * -v:                                   Miscellaneous options.
  1203. * -version:                             Miscellaneous options.
  1204. * etags requires -psl:                  Declarations.
  1205. * .indent.pro file:                     Invoking indent.
  1206. * Beginning indent:                     Invoking indent.
  1207. * Berkeley style:                       Common styles.
  1208. * Blank lines:                          Blank lines.
  1209. * Comments:                             Comments.
  1210. * GNU style:                            Common styles.
  1211. * Initialization file:                  Invoking indent.
  1212. * Invoking indent:                      Invoking indent.
  1213. * Kernighan & Ritchie style:            Common styles.
  1214. * Long options, use of:                 Invoking indent.
  1215. * Original Berkeley style:              Common styles.
  1216. * Output File Specification:            Invoking indent.
  1217. * Standard Output:                      Invoking indent.
  1218. * Starting indent:                      Invoking indent.
  1219. * Typenames:                            Declarations.
  1220. * Using Standard Input:                 Invoking indent.
  1221.  
  1222.  
  1223. 
  1224. Tag Table:
  1225. Node: Top423
  1226. Node: Indent Program934
  1227. Node: Invoking indent1965
  1228. Node: Backup files5146
  1229. Node: Common styles7011
  1230. Node: Blank lines9216
  1231. Node: -bad10168
  1232. Node: -bap10815
  1233. Node: Comments11676
  1234. Node: Statements15997
  1235. Node: Declarations18421
  1236. Node: Indentation20038
  1237. Node: Disabling Formatting22362
  1238. Node: Miscellaneous options24101
  1239. Node: Bugs24652
  1240. Node: Copyright24964
  1241. Node: Option Summary26344
  1242. Node: Index35844
  1243. 
  1244. End Tag Table
  1245.