Artistic Style 1.23
Maintained By:jim Pattee
Original Author:tal Davidson
Usage:astyle [Options] Source1.cpp Source2.cpp [...]
Astyle [Options] < Original > beautified
When indenting a specific file, the resulting indented file retains the
Original File-name. The original pre-indented file is renamed, with a
Suffix of ". Orig" added to the original filename.
Wildcards (* and?) May is used in the filename.
A ' recursive ' option can process directories recursively.
You can use wildcards to specify which files to process, recursively process subdirectories with-R
By default, Astyle are set up to indent C/c++/c#/java files, with 4 spaces
Per indent, a maximal indentation of spaces inside continuous statements,
and NO formatting.
Option ' s Format:
----------------
Long options (starting with '--') must is written one at a time.
Short options (starting with '-') may appended together.
Thus,-BPS4 is the same as-b-p-s4.
Style:
-------------------------
--style=allman OR--style=bsd OR-A1
Allman Style
Allman style formatting/indenting.
Broken brackets.
--style=java OR-A2
Java style
Java style formatting/indenting.
Attached brackets.
--style=k&r OR--style=k/r Or-a3
K&r style
Kernighan & Ritchie Style formatting/indenting.
Linux brackets.
--style=stroustrup OR-A4
Stroustrup style
Stroustrup style formatting/indenting.
Stroustrup brackets.
--style=whitesmith Or-a5
Whitesmith style
Whitesmith style formatting/indenting.
Broken, indented brackets.
Indented class blocks and switch blocks.
--style=banner Or-a6
Banner Style
Banner style formatting/indenting.
Attached, indented brackets.
Indented class blocks and switch blocks.
--style=gnu Or-a7
GNU Style
GNU style formatting/indenting.
Broken brackets, indented blocks, indent is 2 spaces.
--style=linux or-a8
Linux Style
GNU style formatting/indenting.
Linux brackets, indent is 8 spaces.
Tab and Bracket Options:
------------------------
TAB options:
The default tab is 4 spaces.
--indent=spaces=# or-s#
Default line indentation is 4 spaces, you can replace # with indent
--indent=tab OR--indent=tab=# or-t or-t#
Line Indent tab, default tab length equal to 4 spaces
--indent=force-tab=# or-t#
Precedence with space indent
Curly Braces Options:
If No brackets option is set,
The brackets is not being changed.
--brackets=break Or-b
Curly braces are separated from the previous one into two lines
Break brackets from Pre-block code (i.e. ANSI C + + style).
--brackets=attach or-a
Curly braces the previous line on the same line as the previous one
Attach brackets to Pre-block code (i.e. Java/k&r style).
--brackets=linux or-l
The curly braces in the definition block and function block are processed
Break Definition-block brackets and attach Command-block
Brackets.
--brackets=stroustrup Or-u
Handle only curly braces in a function
Attach all brackets except function definition brackets.
Indentation options:
--------------------
--indent-classes or-c
Indent the public Private protected label in the class definition.
Indent ' class ' blocks, so and the inner ' public: ',
' Protected: ' and ' private:headers is indented in
Relation to the class block.
--indent-switches or-s
Indent case block in switch, case and switch are not in the same column
Indent ' switch ' blocks, so that's the inner ' case XXX: '
Headers is indented in relation to the switch block.
--indent-cases or-k
Indent the statement below the case
Indent case blocks from the ' case XXX: ' Headers.
Case statements isn't enclosed in blocks is not indented.
--indent-blocks or-g
Add indents to a block, including curly braces
ADD Extra indentation entire blocks (including brackets).
--indent-brackets Or-b
Add indentation to curly braces
ADD extra indentation to ' {' and '} ' block brackets.
--indent-namespaces Or-n
Indent a namespace definition row
Indent the contents of namespace blocks.
--indent-labels or-l
Label indent
Indent labels So, they appear one Indent less than
The current indentation level, rather than being
Flushed completely to the left (which is the default).
--indent-preprocessor or-w
Multi-line macro definition Indentation
Indent multi-line #define statements.
--max-instatement-indent=# or-m#
Indents across lines, such as parameters in a function definition are in more than one row, then the parameters are indented to the same column
Indent a maximal # spaces in a continuous statement,
Relative to the previous line.
--min-conditional-indent=# or-m#
Indent A minimal # spaces in a continuous conditional
belonging to a conditional header.
formatting options:
-------------------
--break-blocks or-f
Empty lines separate blocks, classes, tags (excluding function blocks) that are not related
Insert empty lines around unrelated blocks, labels, classes, ...
--break-blocks=all or-f
Empty rows separate blocks that are not related, including else catch, and so on
Like--break-blocks, except also insert empty lines
Around closing headers (e.g. ' Else ', ' catch ', ...).
--break-closing-brackets or-y
The curly brace on the left side of the else catch is separated from the else catch
Break brackets before closing headers (e.g. ' Else ', ' catch ', ...).
Use with--brackets=attach,--brackets=linux,
or--brackets=stroustrup.
--break-elseifs OR-E
else if () separated into two rows
Break ' else if () ' statements into the different lines.
--delete-empty-lines Or-x
Delete Extra empty lines
Delete empty lines within a function or method.
It won't delete lines added by the break-blocks options.
--pad-oper or-p
Insert a space at both ends of the operator
Insert space paddings around operators.
--pad-paren or-p
Spaces are inserted inside and outside the brackets
Insert space padding around parenthesis on both the outside
and the inside.
--pad-paren-out or-d
Insert spaces outside parentheses
Insert space padding around parenthesis on the outside only.
--pad-paren-in or-d
Insert spaces outside parentheses
Insert space padding around parenthesis on the inside only.
--unpad-paren Or-u
Remove extra spaces at both ends of brackets
Remove unnecessary space padding around parenthesis. This
Can is used in combination with the ' pad ' options above.
--keep-one-line-statements Or-o
Multiple declarations in a row do not delimit int x;int Y;int Z is not divided into 3 rows
Don ' t break lines containing multiple statements into
Multiple single-statement lines.
--keep-one-line-blocks Or-o
Single-line statements in curly braces are not split
Don ' t break blocks residing completely on one line.
--convert-tabs or-c
tab conversion to Spaces
Convert tabs to the appropriate number of spaces.
--fill-empty-lines OR-E
Line wrapping match either blank lines between blocks insert a space
Fill empty lines with the white space of their
Previous lines.
--mode=c
Working with C files
Indent a C or C + + source file (this is the default).
--mode=java
Working with Jave files
Indent a Java source file.
--mode=cs
Working with C # files
Indent A C # source file.
Other options:
--------------
--suffix=####
Specify the suffix of the backup file
Append the suffix # instead of '. Orig ' to original filename.
--suffix=none Or-n
No copies of documents
Does not retain a backup of the original file.
--options=####
Specify from # # # #文件读取选项信息
Specify an options file # # # to read and use.
--options=none
Prohibit read option information from file
Disable the default options file.
Only the command-line parameters would be used.
--recursive Or-r Or-r
Recursively processing subdirectories
Process subdirectories recursively.
--exclude=####
Exclude folders that are not processed
Specify a file or directory # # # to is excluded from processing.
--errors-to-stdout Or-x
Print errors and help information to standard-output rather than
To Standard-error.
--preserve-date or-z
Do not modify the time
The date and time modified won't is changed in the formatted file.
--verbose or-v
Output verbose processing information
Verbose mode. Extra informational messages'll be displayed.
--formatted Or-q
Only the modified file information is included in the output information
Formatted display mode. Display only the files and that has been formatted.
--quiet Or-q
Ignore All errors
Quiet mode. Suppress all output except error messages.
--version or-v
Output Astyle version
Print version number.
--help or-h OR-?
Help information
Print this help message.
Default Options File:
---------------------
Artistic Style looks for a default options file in the
Following order:
1. The contents of the Artistic_style_options environment
Variable if it exists.
Read options from artistic_style_options environment variable
2. The file called. Astylerc in the directory pointed to by the
HOME environment variable (i.e. $HOME/.astylerc).
The. astylerc file read option from the/home folder
3. The file called Astylerc in the directory pointed
USERPROFILE environment variable (i.e.%userprofile%\astylerc).
Read option information from the Astylerc file under UserProfile
If A default options file is found, the options in this file
'll be parsed before the command-line options.
Long options within the default option file may be written without
The preliminary '--'.
Usage of--options:
My settings in source Insight are AStyle.exe--options=d:\tools\astyle\astyle.cfg%f
Astyle.cfg content is:
-s4-skfxpucnlac
#井号表示是注释
#-s4 line indent with 4 spaces
#-s switch differs from case column, case indentation
#-k Indent case The following statement
#-f Blank line delimited Independent block
#-x Delete extra empty lines
#-p operator ends and exits spaces
#-u remove extra spaces at both ends of brackets
#-c tab to Space
#-n do not make backups
#-l handling of braces in definitions and functions
#-a curly braces on the previous line
Astyle programming language formatting tools in Chinese