⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 indent.1

📁 indent为linux下代码自动格式化工具
💻 1
📖 第 1 页 / 共 4 页
字号:
\`-nlp -ci3\' in effect:.in +5.nf.na  p1 = first_procedure (second_procedure (p2, p3),     third_procedure (p4, p5));.in -5.ad.fiWith \`-lp\' in effect the code looks somewhat clearer:.in +5.nf.na  p1 = first_procedure (second_procedure (p2, p3),                        third_procedure (p4, p5));.in -5.ad.fiWhen a statement is broken in between two or more paren pairs (...),each extra pair causes the indentation level extra indentation:.in +5.nf.naif ((((i < 2 &&        k > 0) || p == 0) &&    q == 1) ||  n = 0).in -5.ad.fiThe option \`-ip\fIN\fR\' can be used to set the extra offset per paren.For instance, \`-ip0\' would format the above as:.in +5.nf.naif ((((i < 2 &&  k > 0) || p == 0) &&  q == 1) ||  n = 0).in -5.ad.fi.B indent\fR assumes that tabs are placed at regular intervals of bothinput and output character streams.  These intervals are by default 8columns wide, but (as of version 1.2) may be changed by the \`-ts\'option.  Tabs are treated as the equivalent number of spaces.The indentation of type declarations in old-style function definitionsis controlled by the \`-ip\' parameter.  This is a numeric parameterspecifying how many spaces to indent type declarations.  For example,the default \`-ip5\' makes definitions look like this:.in +5.nf.nachar *create_world (x, y, scale)     int x;     int y;     float scale;{  . . .}.in -5.ad.fiFor compatibility with other versions of indent, the option \`-nip\'is provided, which is equivalent to \`-ip0\'.ANSI C allows white space to be placed on preprocessor command linesbetween the character \`#\' and the command name.  By default,.B indent\fR removes this space, but specifying the \`-lps\' optiondirects \fBindent\fR to leave this space unmodified. The option \`-ppi\' overrides  \`-nlps\' and  \`-lps\'.This option can be used to request that preprocessor conditional statements canbe indented by to given number of spaces, for example with the option \`-ppi 3\'.in +5.nf.na#if X#if Y#define Z 1#else#define Z 0#endif#endif.in -5.ad.fibecomes.in +5.nf.na#if X#   if Y#      define Z 1#   else#      define Z 0#   endif#endif.in -5.ad.fi.SH "BREAKING LONG LINES"With the option \`-l\fIn\fR\', or \`--line-length\fIn\fR\', it ispossible to specify the maximum length of a line of C code, not includingpossible comments that follow it.When lines become longer then the specified line length, GNU \fBindent\fRtries to break the line at a logical place.  This is new as of version 2.1however and not very intelligent or flexible yet.Currently there are two options that allows one to interfere with thealgorithm that determines where to break a line.The \`-bbo\' option causes GNU \fBindent\fR to prefer to breaklong lines before the boolean operators \fB&&\fR and \fB||\fR.  The\`-nbbo\' option causes GNU \fBindent\fR not have thatpreference.  For example, the default option \`-bbo\' (togetherwith \`--line-length60\' and \`--ignore-newlines\') makes codelook like this:.in +5.nf.na  if (mask      && ((mask[0] == \'\\0\')          || (mask[1] == \'\\0\'              && ((mask[0] == \'0\') || (mask[0] == \'*\'))))).in -5.ad.fiUsing the option \`-nbbo\' will make it look like this:.in +5.nf.na  if (mask &&      ((mask[0] == \'\\0\') ||       (mask[1] == \'\\0\' &&        ((mask[0] == \'0\') || (mask[0] == \'*\'))))).in -5.ad.fiThe default \`-hnl\', however, honours newlines in the input file bygiving them the highest possible priority to break lines at.  For example,when the input file looks like this:.in +5.nf.na  if (mask      && ((mask[0] == \'\\0\')      || (mask[1] == \'\\0\' && ((mask[0] == \'0\') || (mask[0] == \'*\'))))).in -5.ad.fithen using the option \`-hnl\', or \`--honour-newlines\',together with the previously mentioned \`-nbbo\' and\`--line-length60\', will cause the output not to be what is givenin the last example but instead will prefer to break at the positionswhere the code was broken in the input file:.in +5.nf.na  if (mask      && ((mask[0] == \'\\0\')          || (mask[1] == \'\\0\' &&              ((mask[0] == \'0\') || (mask[0] == \'*\'))))).in -5.ad.fiThe idea behind this option is that lines which are too long, but are alreadybroken up, will not be touched by GNU \fBindent\fR.  Really messy codeshould be run through \fBindent\fR at least once using the\`--ignore-newlines\' option though..SH "DISABLING FORMATTING"Formatting of C code may be disabled for portions of a program byembedding special \fIcontrol comments\fR in the program.  To turn offformatting for a section of a program, place the disabling controlcomment \fB/* *INDENT-OFF* */\fR on a line by itself just before thatsection.  Program text scanned after this control comment is outputprecisely as input with no modifications until the correspondingenabling comment is scanned on a line by itself.  The disabling controlcomment is \fB/* *INDENT-ON* */\fR, and any text following the commenton the line is also output unformatted.  Formatting begins again withthe input line following the enabling control comment.More precisely, \fBindent\fR does not attempt to verify the closingdelimiter (\fB*/\fR) for these C comments, and any whitespace on theline is totally transparent.These control comments also function in their C++ formats, namely.B // *INDENT-OFF*\fR and \fB// *INDENT-ON*\fR.It should be noted that the internal state of \fBindent\fR remainsunchanged over the course of the unformatted section.  Thus, forexample, turning off formatting in the middle of a function andcontinuing it after the end of the function may lead to bizarreresults.  It is therefore wise to be somewhat modular in selecting codeto be left unformatted.As a historical note, some earlier versions of \fBindent\fR producederror messages beginning with \fB*INDENT**\fR.  These versions of.B indent\fR were written to ignore any input text lines which beganwith such error messages.  I have removed this incestuous feature fromGNU \fBindent\fR..SH "MISCELLANEOUS OPTIONS"To find out what version of \fBindent\fR you have, use the command.B indent -version\fR.  This will report the version number of.B indent\fR, without doing any of the normal processing.The \`-v\' option can be used to turn on verbose mode.  When inverbose mode, \fBindent\fR reports when it splits one line of inputinto two more more lines of output, and gives some size statistics atcompletion. The \`-pmt\' option causes \fBindent\fR to preserve the accessand modification times on the output files.  Using this optionhas the advantage that running indent on all source and headerfiles in a project won\'t cause \fBmake\fR to rebuild all targets.This option is only available on Operating Systems that have thePOSIX \fButime(2)\fR function..SH "BUGS"Please report any bugs to bug-indent@gnu.org.When \fBindent\fR is run twice on a file, with the same profile,it should \fInever\fR change that file the second time.  With thecurrent design of \fBindent\fR, this can not be guaranteed,and it has not been extensively tested..B indent\fR does not understand C.  In some cases this leads tothe inability to join lines.  The result is that running a filethrough \fBindent\fR is \fIirreversible\fR, even if the used inputfile was the result of running \fBindent\fR with a given profile(\`.indent.pro\').While an attempt was made to get \fBindent\fR working for C++, itwill not do a good job on any C++ source except the very simplest..B indent\fR does not look at the given \`--line-length\' optionwhen writing comments to the output file.  This results often in commentsbeing put far to the right.  In order to prohibit \fBindent\fR fromjoining a broken line that has a comment at the end, make sure that thecomments start on the first line of the break..B indent\fR does not count lines and comments (see the \`-v\'option) when \fBindent\fR is turned off with .B /* *INDENT-OFF* */\fR.Comments of the form \fB/*UPPERCASE*/\fR are not treated as comment but as anidentifier, causing them to be joined with the next line. This renderscomments of this type useless, unless they are embedded in the code tobegin with..SH "COPYRIGHT"The following copyright notice applies to the \fBindent\fR program.The copyright and copying permissions for this manual appear near thebeginning of \`indent.texinfo\' and \`indent.info\', and near theend of \`indent.1\'..nf.naCopyright (c) 2001 David Ingamells.Copyright (c) 1999 Carlo Wood.Copyright (c) 1995, 1996 Joseph Arceneaux.Copyright (c) 1989, 1992, 1993, 1994, 1995, 1996 Free Software FoundationCopyright (c) 1985 Sun Microsystems, Inc.Copyright (c) 1980 The Regents of the University of California.Copyright (c) 1976 Board of Trustees of the University of Illinois.All rights reserved.Redistribution and use in source and binary forms are permittedprovided that the above copyright notice and this paragraph areduplicated in all such forms and that any documentation,advertising materials, and other materials related to suchdistribution and use acknowledge that the software was developedby the University of California, Berkeley, the University of Illinois,Urbana, and Sun Microsystems, Inc.  The name of either Universityor Sun Microsystems may not be used to endorse or promote productsderived from this software without specific prior written permission.THIS SOFTWARE IS PROVIDED \`\`AS IS\'\' AND WITHOUT ANY EXPRESS ORIMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIEDWARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULARPURPOSE..ad.fi.SH "Options\' Cross Key"Here is a list of options alphabetized by long option, to help you findthe corresponding short option..in +5.nf.na--blank-lines-after-commas                      -bc             --blank-lines-after-declarations                -bad            --blank-lines-after-procedures                  -bap            --blank-lines-before-block-comments             -bbb            --braces-after-if-line                          -bl             --brace-indent                                  -bli--braces-after-struct-decl-line                 -bls--braces-on-if-line                             -br             --braces-on-struct-decl-line                    -brs--break-after-boolean-operator                  -nbbo--break-before-boolean-operator                 -bbo--break-function-decl-args                      -bfda--break-function-decl-args-end                  -bfde--case-indentation                              -cli\fIn\fR     --case-brace-indentation                        -cbi\fIn\fR--comment-delimiters-on-blank-lines             -cdb            --comment-indentation                           -c\fIn\fR       --continuation-indentation                      -ci\fIn\fR      --continue-at-parentheses                       -lp             --cuddle-do-while                               -cdw--cuddle-else                                   -ce             --declaration-comment-column                    -cd\fIn\fR      --declaration-indentation                       -di\fIn\fR      --dont-break-function-decl-args                 -nbfda--dont-break-function-decl-args-end             -nbfde--dont-break-procedure-type                     -npsl           --dont-cuddle-do-while                          -ncdw--dont-cuddle-else                              -nce            --dont-format-comments                          -nfca           --dont-format-first-column-comments             -nfc1           --dont-line-up-parentheses                      -nlp            --dont-space-special-semicolon                  -nss--dont-star-comments                            -nsc            --else-endif-column                             -cp\fIn\fR--format-all-comments                           -fca            --format-first-column-comments                  -fc1            --gnu-style                                     -gnu            --honour-newlines                               -hnl--ignore-newlines                               -nhnl--ignore-profile                                -npro           --indent-level                                  -i\fIn\fR       --k-and-r-style                                 -kr             --leave-optional-blank-lines                    -nsob           --leave-preprocessor-space                      -lps--line-comments-indentation                     -d\fIn\fR       --line-length                                   -l\fIn\fR       --no-blank-lines-after-commas                   -nbc            --no-blank-lines-after-declarations             -nbad           --no-blank-lines-after-procedures               -nbap           --no-blank-lines-before-block-comments          -nbbb           --no-comment-delimiters-on-blank-lines          -ncdb           --no-space-after-casts                          -ncs            --no-parameter-indentation                      -nip            --no-space-after-for				-nsaf--no-space-after-function-call-names            -npcs           --no-space-after-if				-nsai--no-space-after-parentheses                    -nprs--no-space-after-while				-nsaw--no-tabs                                       -nut--no-verbosity                                  -nv             --original                                      -orig--parameter-indentation                         -ip\fIn\fR      --paren-indentation                             -pi\fIn\fR--preserve-mtime				-pmt--procnames-start-lines                         -psl            --space-after-cast                              -cs             --space-after-for				-saf--space-after-if				-sai--space-after-parentheses                       -prs--space-after-procedure-calls                   -pcs            --space-after-while				-saw--space-special-semicolon                       -ss             --standard-output                               -st             --start-left-side-of-comments                   -sc             --struct-brace-indentation                      -sbi\fIn\fR--swallow-optional-blank-lines                  -sob            --tab-size                                      -ts\fIn\fR      --use-tabs                                      -ut--verbose                                       -v              .in -5.ad.fi.SH "RETURN VALUE"Unknown.SH FILES.br.nf.\" set tabstop to longest possible filename, plus a wee bit.ta \w'$HOME/.indent.pro   'u\fI$HOME/.indent.pro\fR	holds default options for indent..SH "AUTHORS".brCarlo Wood.brJoseph Arceneaux.brJim Kingdon.brDavid Ingamells.SH "HISTORY"Derived from the UCB program "indent"..SH "COPYING"Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.Copyright (C) 1995, 1996 Joseph Arceneaux.Copyright (C) 1999 Carlo Wood.Copyright (C) 2001 David Ingamells.Permission is granted to make and distribute verbatim copies ofthis manual provided the copyright notice and this permission noticeare preserved on all copies.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -