diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..11dfa6b
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2016 by Jim Pattee Artistic Style 2.05
+ Artistic Style 2.06
A Free, Fast, and Small Automatic Formatter
+ General Information
@@ -45,26 +42,19 @@
Contents
- Quick Start -
+ Quick Start- Usage -
+ Usage- Options -
+ Options- Options File -
+ Options File + Disable Formatting + Bracket Style Optionsdefault bracket style style=allman @@ -80,30 +70,24 @@ style=1tbs style=google style=pico - style=lisp -
+ style=lisp- Tab Options -
+ Tab Optionsdefault indent indent=spaces indent=tab indent=force‑tab - --indent=force‑tab‑x -
+ --indent=force‑tab‑x + Bracket Modify Optionsattach‑namespaces attach‑classes attach‑inlines - attach‑extern‑c -
+ attach‑extern‑c + Indentation Optionsindent‑classes indent‑modifiers @@ -119,12 +103,12 @@ max‑instatement‑indent
- Padding Options -
+ Padding Optionsbreak‑blocks break‑blocks=all pad‑oper + pad‑comma pad‑paren pad‑paren‑out pad‑first‑paren‑out @@ -134,11 +118,9 @@ delete‑empty‑lines fill‑empty‑lines align‑pointer - align‑reference -
+ align‑reference + Formatting Optionsbreak‑closing‑brackets break‑elseifs @@ -152,20 +134,18 @@ remove‑comment‑prefix max‑code‑length break‑after‑logical - mode -
+ mode + Objective‑C Options- align‑method‑colon pad‑method‑prefix unpad‑method‑prefix - pad‑method‑colon -
+ pad‑return‑type + unpad‑return‑type + align‑method‑colon + pad‑method‑colon- Other Options -
+ Other Optionssuffix suffix=none recursive @@ -178,11 +158,9 @@ verbose formatted quiet - lineend -
+ lineend + Command Line Onlyoptions options=none @@ -190,11 +168,9 @@ version help html - html= -
+ html=- -
+Line endings in the formatted file will be the same as the input file. If there are mixed line endings the most - frequent occurrence will be used. There is also an option to specify or change the line endings. -
+ frequent occurrence will be used. There is also an option to specify or change the line endings.
Artistic Style will determine the file type from the file extension. The extension ".java" indicates a Java file,
and ".cs" indicates a C# file. Everything else is a C type file (C, C++, C++/CLI, or Objective-C). If you are
- using a non-standard file extension for Java or C#, use one of the --mode=
options.
-
--mode=
options.
.orig
appended to the original file name. (This can be set to
a different string by the option --suffix=
, or suppressed altogether by the options -n
or --suffix=none
). Thus, after indenting SourceFile.cpp
the indented file will
- be named SourceFile.cpp
, while the original pre-indented file will be renamed to SourceFile.cpp.orig
.
-
+ be named SourceFile.cpp
, while the original pre-indented file will be renamed to
+ SourceFile.cpp.orig
.
- Artistic Style has been internationalized to process files and directories in any language. -
+ Artistic Style has been internationalized to process files and directories in any language.It has also been translated into several languages. The translation to use is determined from the User Locale for Windows and the LANG environment variable for other systems. The translation will be done automatically from these settings. If no translation is available it will default to English. There is an ascii option to use English - instead of the system language. -
+ instead of the system language.The source code for the translations is at the end of ASLocalizer.cpp in the form of an English‑Translation pair. If you make corrections to a translation, send the source as a bug report and it will be included in the - next release. -
+ next release.To add a new language, add a new translation class to ASLocalizer.h. Add the English‑Translation pair to the constructor in ASLocalizer.cpp. Update the WinLangCode array and add the language code to the function setTranslationClass(). The ASLocalizer.cpp program contains comments that give web pages for obtaining the LCIDs and language codes. - Send the source code as a bug report and it will be included in the next release. -
+ Send the source code as a bug report and it will be included in the next release.The names of special characters used in programming vary by region. The terminology used by Artistic Style, - followed by other common names, is: -
+ followed by other common names, is:brackets { } ‑ also called braces, curly brackets, or curly braces.
parens ( ) ‑ also called parentheses, brackets, round brackets, circle brackets, or soft brackets.
@@ -273,17 +241,19 @@ or chevrons.
- Artistic Style can format standard class library statements such as Open GL, wxWidgets, Qt, and MFC. -
+ Visual Studio, and possibly other development environments, has an Edit option "Align Assignments" that will align + assignment operators across multiple lines. There is also an extension named "Code alignment" that will align + the code on other items as well. Formatting with these options and extensions can be used with Artistic Style. + The space padding will be maintained and the alignment will be preserved. ++ Artistic Style can format standard class library statements such as Open GL, wxWidgets, Qt, and MFC.
Embedded assembler language is formatted correctly. This includes extended assembly and Microsoft specific assembler - lines and blocks. -
+ lines and blocks.Artistic Style can format embedded SQL statements. The SQL formatting will be maintained as long as the standard hanging indent format is used. If the "exec sql" statement is indented more than the following statements, the - SQL will be aligned in a single column. -
+ SQL will be aligned in a single column.Unicode files encoded as UTF‑16, both big and little endian, will be formatted. The files must begin with a byte order mark (BOM) to be recognized. Files encoded as UTF‑32 will be rejected. Some compilers do not @@ -292,18 +262,16 @@ command line is "iconv ‑f UTF‑16 ‑t UTF‑8 < filein.cpp > fileout.cpp. Visual Studio can convert the files from the "File > Advanced Save Options" menu. Then select encoding "Unicode (UTF‑8 with signature) - Codepage 65001". There are other development environments and text editors, such as SciTE, that - can convert files to UTF‑8. -
+ can convert files to UTF‑8.Embedded statements that are multiple-line and are NOT in a C-type format, such as Python, are usually mal-formatted (a C-type format has blocks enclosed by brackets and statements terminated by a semi-colon). Macros that define functions may cause the following code to be mal-formatted because the macro is missing the brackets and semi-colons from the definition. If you have source code with these types of statements, exclude them with the - exclude=#### option described in the Other Options section. -
+ exclude=#### option described in the Other Options + section.- -
+- If you have never used Artistic Style there are a couple of ways to start. -
+ If you have never used Artistic Style there are a couple of ways to start.- One is to run it with no options at all. This will use the - default bracket - style - , 4 spaces per indent, and no formatting changes. This will break the brackets for one + One is to run it with no options at all. This will use the default bracket + style, 4 spaces per indent, and no formatting changes. This will break the brackets for one line blocks and will break one line statements. To change this use the option keep-one-line-blocks and/or keep-one-line-statements described in the - Formatting Options section -
+ Formatting Options section- Another way is to use one of the bracket styles described in the - Bracket Style - Options - section. Select one with a bracket formatting style you like. If no indentation option is set, the - default option of 4 spaces will be used. These options also break one line blocks and one line statements as - described above. -
+ Another way is to use one of the bracket styles described in the Bracket Style + Options section. Select one with a bracket formatting style you like. If no indentation option is set, + the default option of 4 spaces will be used. These options also break one line blocks and one line statements + as described above.- Once you are familiar with the options you can customize the format to your personal preference. -
+ Once you are familiar with the options you can customize the format to your personal preference.- -
+Artistic style is a console program that receives information from the command line. The format of the command - line is: -
+ line is:astyle [OPTIONS] SourceFile1 SourceFile2 SourceFile3 [ . . . ]
The block parens [ ] indicate that more than one option or more than one file name can be entered. They are NOT - actually included in the command. For the options format see the following Options section. -
+ actually included in the command. For the options format see the following Options section.- Example to format a single file: -
++ Example to format a single file:
astyle --style=allman /home/user/project/foo.cpp-
- Example to format all .cpp and .h files recursively: -
++ Example to format all .cpp and .h files recursively:
astyle --style=allman --recursive /home/user/project/*.cpp /home/user/project/*.h
- Another option will format a single file and change the name: -
-astyle [OPTIONS] < OriginalSourceFile > BeautifiedSourceFile + The < and > characters may be used to redirect the files into standard input (stdin) and out of standard output + (stdout) - don't forget them! With this option only one file at a time can be formatted. Wildcards are not + recognized, there are no console messages, and a backup is not created. On Windows the output will always have + Windows line ends. ++++ Example of redirection option to format a single file and change the name:
+astyle --style=allman < OriginalSourceFile > BeautifiedSourceFile-- This option can be used to display the formatted file without updating: -
-astyle [OPTIONS] < OriginalSourceFile | less +++ The redirection option may be used to display the formatted file without updating:
+astyle --style=allman < OriginalSourceFile | less+- The < and > characters are used - to redirect the files into standard input (cin) and out of standard output (cout) - don't forget them! With this - option only one file at a time can be formatted. Wildcards are not recognized, there are no console messages, - and a backup is not created. On Windows the output will always have Windows line ends. -
-- -
+
@@ -392,28 +347,23 @@Not specifying any options will result in the default bracket style, - 4 spaces per indent, and no formatting changes. -
+ 4 spaces per indent, and no formatting changes.- Options may be written in two different ways. -
+ Options may be written in two different ways.Long options
These options start with '--', and must be written one at a time.
+ (Example: '
- (Example: '--style=allman --indent=spaces=4
') ---style=allman --indent=spaces=4
')Short Options
These options start with a single '-', and may be concatenated together.
+ (Example: '
- (Example: '-bps4
' is the same as writing '-b -p -s4
'.) --bps4
' is the same as writing '-b -p -s4
'.)- -
+
@@ -421,24 +371,19 @@Options File
- An OPTIONAL default options file may be used to supplement or replace the command line options. -
+ An OPTIONAL default options file may be used to supplement or replace the command line options.
- Example of a default options file: -
+ Example of a default options file:# this line is a comment --style=allman # this is a line-end comment @@ -462,77 +406,60 @@ indent-switches # cannot do this on the command line -M60Ucv
- -
+- Formatting and indenting can be disabled with comment tags inserted in the source code. -
+ Formatting and indenting can be disabled with comment tags inserted in the source code. -Blocks of code can be disabled using "off" and "on" tags. The tags are included in the source file as comments. The comment may be a C comment (/* ... */) or a C++ line comment (//). The tag must be included in a single line comment. If the comment exceeds one line the indent tag will be ignored. Additional information - can be included with the tag. -
+ can be included with the tag.The beginning tag is "*INDENT-OFF*" and the ending tag is "*INDENT-ON*". They may be used anywhere in the program with the following condition; parsing is partially disabled between the tags. Disabling partial statements may result in incorrect formatting after the ending tag. If this happens expand - the tags to include additional code. -
+ the tags to include additional code.- The following retains the format of a preprocessor define: -
-// *INDENT-OFF*
+ The following retains the format of a preprocessor define:
+ // *INDENT-OFF*
#define FOO_DECLARE_int32_(name) \
FOO_API_ extern ::Int32 FOO_FLAG(name)
-// *INDENT-ON*
+// *INDENT-ON*
Artistic Style cannot always determine the usage of symbols with more than one meaning. For example an asterisk (*) can be multiplication, a pointer, or a pointer dereference. The "&" and "&&" symbols are a similar - problem. -
+ problem.If a symbol is being padded incorrectly, padding it manually may fix the problem. If it is still being padded incorrectly, then disabling the formatting may be necessary. To avoid having to use the "disable block" - tags above, a single line disable is available. -
+ tags above, a single line disable is available.A line-end comment tag "*NOPAD* will disable the "pad-oper", "align-pointer", and "align-reference" options. Parsing does NOT stop and all other formatting will be applied to the line. The tag applies to the - one line only. -
+ one line only.- The following prevents the operator padding from - changing: -
+ The following prevents the operator padding from changing:size_t foo = (unsigned int) -1; // *NOPAD*
- -
+Bracket Style options define the bracket style to use. All options default to 4 spaces per indent, indented with - spaces. - By default, none of the styles indent namespaces. Other indentations are indicated in the individual style + spaces. By default, none of the styles indent namespaces. Other indentations are indicated in the individual style description. All options will break the brackets for one line blocks and will break one line statements. To change - this - use the option keep-one-line-blocks and/or - keep-one-line-statements - described in the Formatting Options section -
+ this use the option keep-one-line-blocks and/or + keep-one-line-statements described in the Formatting Options + section.- -
+
default bracket style
If no bracket style is requested, the default bracket style will be used. The opening brackets are not changed
- and the closing brackets will be broken from the preceding line. There are a few exceptions to this.
-
- -
+
--style=allman / --style=bsd / --style=break / -A1
- Allman style uses broken brackets.
-
int Foo(bool isBar) { if (isBar) - { + { bar(); return 1; - } + } else return 0; -} --
- -
-
- --style=java / --style=attach / -A2
- Java style uses attached brackets.
-
int Foo(bool isBar) { - if (isBar) { - bar(); - return 1; - } else - return 0; }
- -
+ +
+ --style=java / --style=attach / -A2
+ Java style uses attached brackets.
int Foo(bool isBar) { + if (isBar) { + bar(); + return 1; + } else + return 0; +} ++
+
--style=kr / --style=k&r / --style=k/r / -A3
Kernighan & Ritchie style uses linux brackets. Opening brackets are broken from namespaces, classes, and function
definitions. Brackets are attached to everything else including statements within a function, arrays, structs,
- and enums.
-
Using the k&r option may cause problems because of the &. This can be resolved by enclosing the k&r - in quotes (e.g. ‑‑style="k&r") or by using one of the alternates ‑‑style=kr or ‑‑style=k/r. -
+ in quotes (e.g. ‑‑style="k&r") or by using one of the alternates ‑‑style=kr or + ‑‑style=k/r.int Foo(bool isBar) +int Foo(bool isBar) { if (isBar) { bar(); return 1; - } else + } else return 0; }
- -
+
--style=stroustrup / -A4
Stroustrup style uses stroustrup brackets. Brackets are broken from function definitions only. Brackets are attached
to everything else including namespaces, classes, and statements within a function, arrays, structs, and enums.
- This style frequently is used with an indent of 5 spaces.
-
int Foo(bool isBar) +int Foo(bool isBar) { - if (isBar) { - bar(); - return 1; - } else - return 0; + if (isBar) { + bar(); + return 1; + } else + return 0; }
- -
+
--style=whitesmith / -A5
Whitesmith style uses broken, indented brackets. Switch blocks and class blocks are indented to prevent a 'hanging
- indent' with following case statements and C++ class modifiers (public, private, protected).
-
int Foo(bool isBar) - { +int Foo(bool isBar) + { if (isBar) { bar(); @@ -656,19 +568,17 @@ indent-switches # cannot do this on the command line } else return 0; - } + }
- -
+
--style=vtk / -A15
VTK (Visualization Toolkit) style uses broken, indented brackets, except for the opening bracket. Switch blocks
- are indented to prevent a 'hanging indent' with following case statements.
-
int Foo(bool isBar) +int Foo(bool isBar) { if (isBar) { @@ -681,13 +591,11 @@ indent-switches # cannot do this on the command line
- -
+ + indent' with following case statements and C++ class modifiers (public, private, protected).int Foo(bool isBar) { if (isBar) { @@ -696,48 +604,42 @@ indent-switches # cannot do this on the command line } else return 0; - } + }
- -
+
--style=gnu / -A7
GNU style uses broken brackets and indented blocks. This style frequently is used with
- an indent of 2 spaces.
-
Extra indentation is added to blocks within a function. The opening bracket for namespaces, classes, - and functions is not indented. -
+ and functions is not indented.int Foo(bool isBar) { - if (isBar) + if (isBar) { - bar(); - return 1; + bar(); + return 1; } - else - return 0; + else + return 0; }
- -
+
--style=linux / --style=knf / -A8
Linux style uses linux brackets. Opening brackets are broken from namespace, class, and function
definitions. Brackets are attached to everything else including statements within a function, arrays, structs,
and enums. Minimum conditional indent is one-half indent. If you want a different minimum conditional
indent use the K&R style instead. This style works best with a large indent. It frequently is used with an
- indent of 8 spaces.
-
- Also known as Kernel Normal Form (KNF) style, this is the style used in the Linux kernel. -
+ Also known as Kernel Normal Form (KNF) style, this is the style used in the Linux kernel.int Foo(bool isBar) { @@ -750,97 +652,87 @@ indent-switches # cannot do this on the command line
- -
+
--style=horstmann / -A9
- Horstmann style uses run-in brackets. Brackets are broken and allow run-in statements.
- Switches are indented to allow a run-in to the opening switch block. This style frequently is used with an indent
- of 3 spaces.
-
int Foo(bool isBar) -{ if (isBar) - { bar(); - return 1; - } else - return 0; +{ if (isBar) + { bar(); + return 1; + } + else + return 0; }
- -
+
--style=1tbs / --style=otbs / -A10
"One True Brace Style" uses linux brackets and adds brackets to unbracketed one line conditional
statements. Opening brackets are broken from namespaces, classes, and function definitions. Brackets are attached
- to everything else including statements within a function, arrays, structs, and enums.
-
In the following example brackets have been added to the "return 0;
" statement. The option
- ‑‑add‑one‑line‑brackets can also be used with this style.
-
int Foo(bool isBar) { if (isFoo) { bar(); return 1; - } else { + } else { return 0; - } + } }
- -
+
--style=google / -A14
Google style uses attached brackets and indented class access modifiers. See the indent-modifiers
- option for an example of the indented modifiers format. This style frequently is used with an indent of 2 spaces.
-
int Foo(bool isBar) { if (isBar) { bar(); return 1; - } else + } else return 0; }
- -
+
--style=pico / -A11
Pico style uses run-in brackets and attached closing brackets. Opening brackets are broken
and allow run-in statements. The closing bracket is attached to the last line in the block. Switches are indented
to allow a run-in to the opening switch block. The style implies keep-one-line-blocks and keep-one-line-statements.
If add-brackets is used they will be added as one-line brackets. This style frequently is used with an indent
- of 2 spaces.
-
int Foo(bool isBar) -{ if (isBar) - { bar(); - return 1; } +{ if (isBar) + { bar(); + return 1; } else - return 0; } + return 0; }
- -
+
--style=lisp / --style=python / -A12
Lisp style uses attached opening and closing brackets. Opening brackets are attached at the
end of the statement. The closing bracket is attached to the last line in the block. The style implies keep-one-line-statements
but NOT keep-one-line-blocks. This style does not support one-line brackets. If add-one-line-brackets is used
- they will be added as multiple-line brackets.
-
int Foo(bool isBar) { if (isBar) { @@ -851,8 +743,7 @@ indent-switches # cannot do this on the command line
- -
+The following examples show whitespace characters. A space is indicated with a . (dot), a tab - is indicated by a > (greater than). -
+ is indicated by a > (greater than).
default indent
- If no indentation option is set, the default option of 4 spaces will be used (e.g.
- -s4
+ If no indentation option is set, the default option of 4 spaces will be used (e.g.
-s4
--indent=spaces=4
-
).
-
- with default values: -
+ with default values:void Foo() { ....if (isBar1 ............&& isBar2) // indent of this line can be changed with min-conditional-indent @@ -882,19 +769,16 @@ indent-switches # cannot do this on the command line
- -
+
--indent=spaces / --indent=spaces=# / -s#
- Indent using # spaces per indent (e.g. -s3
- --indent=spaces=3
+ Indent using # spaces per indent (e.g.
-s3
--indent=spaces=3
). # must be between 2 and 20. Not specifying # will result in a default of
- 4 spaces per indent.
-
- with indent=spaces=3 -
+ with indent=spaces=3void Foo() { ...if (isBar1 .........&& isBar2) // indent of this line can be changed with min-conditional-indent @@ -903,19 +787,16 @@ indent-switches # cannot do this on the command line
- -
+
--indent=tab / --indent=tab=# / -t / -t#
Indent using tabs for indentation, and spaces for continuation line alignment. This ensures that
the code is displayed correctly regardless of the viewer’s tab size. Treat each indent as # spaces
(e.g. -t6
/ --indent=tab=6
).
- # must be between 2 and 20. If no # is set, treats indents as 4 spaces.
-
- with indent=tab: -
+ with indent=tab:void Foo() { > if (isBar1 > ........&& isBar2) // indent of this line can be changed with min-conditional-indent @@ -923,8 +804,7 @@ indent-switches # cannot do this on the command line }
- with style=linux, indent=tab=8: -
+ with style=linux, indent=tab=8:void Foo() { > if (isBar1 @@ -934,47 +814,40 @@ indent-switches # cannot do this on the command line
- -
+
--indent=force-tab / --indent=force-tab=# / -T / -T#
Indent using all tab characters, if possible. If a continuation line is not an even number of
tabs, spaces will be added at the end. Treat each tab as # spaces (e.g. -T6
/ --indent=force-tab=6
). # must be between
- 2 and 20. If no # is set, treats tabs as 4 spaces.
-
- with indent=force-tab: -
+ with indent=force-tab:void Foo() { -> if (isBar1 -> > > && isBar2) // indent of this line can be changed with min-conditional-indent -> > bar(); +> if (isBar1 +> > > && isBar2) // indent of this line can be changed with min-conditional-indent +> > bar(); }
- -
+
-
- --indent=force-tab-x / --indent=force-tab-x=# / -xT / -xT#
+
--indent=force-tab-x / --indent=force-tab-x=# / -xT / -xT#
This force-tab option allows the tab length to be set to a length that is different than the indent length. This
may cause the indentation to be a mix of both tabs and spaces. Tabs will be used to indent, if
- possible. If a tab indent cannot be used, spaces will be used instead.
-
This option sets the tab length. Treat each tab as # spaces (e.g. -xT6
/ --indent=force-tab-x=6
). # must be between
2 and 20. If no # is set, treats tabs as 8 spaces. To change the indent length from the default
- of 4 spaces the option "indent=force-tab" must also be used.
-
- with indent=force-tab-x (default tab length of 8 and default indent length of 4): -
+ with indent=force-tab-x (default tab length of 8 and default indent length of 4):void Foo() { ....if (isBar1 > ....&& isBar2) // indent of this line can be changed with min-conditional-indent @@ -983,8 +856,7 @@ indent-switches # cannot do this on the command line
- -
+
--attach-namespaces / -xn
- Attach brackets to a namespace statement. This is done regardless of the bracket style being used.
-
- the bracket is always attached to a namespace statement: -
+ the bracket is always attached to a namespace statement:namespace FooName { ... }
- -
+
--attach-classes / -xc
- Attach brackets to a class statement. This is done regardless of the bracket style being used.
-
- the bracket is always attached to a class statement: -
+ the bracket is always attached to a class statement:class FooClass { ... };
- -
+
--attach-inlines / -xl
- Attach brackets to class and struct inline function definitions. This is not done for run-in type brackets (Horstmann
- and Pico styles). This option is effective for C++ files only.
-
- all brackets are always attached to class and struct inline function definitions: -
+ all brackets are always attached to class and struct inline function definitions:class FooClass { void Foo() { @@ -1041,36 +905,30 @@ indent-switches # cannot do this on the command line
- -
+
--attach-extern-c / -xk
Attach brackets to a bracketed extern "C" statement. This is done regardless of the bracket style being used.
- This option is effective for C++ files only.
-
An extern "C" statement that is part of a function definition is formatted according to the requested bracket style. Bracketed extern "C" statements are unaffected by the bracket style and this option is the only way to - change them. -
+ change them.- this option attaches brackets to a bracketed extern "C" statement: -
+ this option attaches brackets to a bracketed extern "C" statement:#ifdef __cplusplus
extern "C" {
#endif
- but function definitions are formatted according to the requested bracket style: -
+ but function definitions are formatted according to the requested bracket style:extern "C" EXPORT void STDCALL Foo()
{}
- -
+--indent-classes / -C
class
' and 'struct
' blocks so that the entire block is indented. The struct
blocks are indented only if an access modifier, 'public:
', 'protected:
' or 'private:
',
- is declared somewhere in the struct. This option is effective for C++ files only.
-
+ is declared somewhere in the struct. This option is effective for C++ files only.
class Foo { @@ -1092,8 +949,7 @@ public: };
- becomes: -
+ becomes:class Foo
{
public:
@@ -1103,14 +959,12 @@ public:
- -
+
--indent-modifiers / -xG
Indent 'class
' and 'struct
' access modifiers, 'public:
', 'protected:
'
and 'private:
', one half indent. The rest of the class is not indented. This option is effective
- for C++ files only. If used with indent‑classes this option will be ignored.
-
class Foo { @@ -1120,8 +974,7 @@ public: };
- becomes: -
+ becomes:class Foo
{
public:
@@ -1131,19 +984,18 @@ public:
- -
+
--indent-switches / -S
Indent 'switch
' blocks so that the 'case X:
' statements are indented in the switch
- block. The entire case block is indented.
-
switch (foo) { case 1: a += 1; break; + case 2: { a += 2; @@ -1152,50 +1004,49 @@ case 2: }
- becomes: -
+ becomes:switch (foo) { case 1: a += 1; break; + case 2: - { + { a += 2; break; - } + } }
- -
+
--indent-cases / -K
Indent 'case X:
' blocks from the 'case X:
' headers. Case statements not enclosed in
- blocks are NOT indented.
-
switch (foo) { case 1: a += 1; break; + case 2: - { + { a += 2; break; - } + } }
- becomes: -
+ becomes:switch (foo) { case 1: a += 1; break; + case 2: { a += 2; @@ -1205,12 +1056,10 @@ case 2:
- -
+
--indent-namespaces / -N
- Add extra indentation to namespace blocks. This option has no effect on Java files.
-
namespace foospace { @@ -1223,27 +1072,24 @@ class Foo }
- becomes: -
+ becomes:namespace foospace { class Foo - { + { public: Foo(); virtual ~Foo(); - }; + }; }
- -
+
--indent-labels / -L
Add extra indentation to labels so they appear 1 indent less than the current indentation, rather than being flushed
- to the left (the default).
-
void Foo() { while (isFoo) { @@ -1256,8 +1102,7 @@ error: }
- becomes (with indented 'error:'): -
+ becomes (with indented 'error:'):void Foo() { while (isFoo) { if (isFoo) @@ -1265,33 +1110,31 @@ error: ... error: ... - } + } }
- -
+
--indent-preproc-block / -xW
Indent preprocessor blocks at bracket level zero, and immediately within a namespace. There are restrictions on
what will be indented. Blocks within methods, classes, arrays, etc, will not be indented. Blocks containing brackets
- or multi-line define statements will not be indented. Without this option the preprocessor block is not indented.
-
#ifdef _WIN32 -#include <windows.h> +#include <windows.h> #ifndef NO_EXPORT #define EXPORT #endif #endif
- becomes: -
+ becomes:#ifdef _WIN32 - #include <windows.h> + #include <windows.h> #ifndef NO_EXPORT #define EXPORT #endif @@ -1299,34 +1142,29 @@ error:
- -
+
--indent-preproc-define / -w
Indent multi-line preprocessor definitions ending with a backslash. Should be used with --convert-tabs for proper
results. Does a pretty good job, but cannot perform miracles in obfuscated preprocessor definitions. Without this
- option the preprocessor statements remain unchanged.
-
#define Is_Bar(arg,a,b) \ (Is_Foo((arg), (a)) \ || Is_Foo((arg), (b)))
- becomes: -
+ becomes:#define Is_Bar(arg,a,b) \ (Is_Foo((arg), (a)) \ || Is_Foo((arg), (b)))
- -
+
--indent-preproc-cond / -xw
- Indent preprocessor conditional statements to the same level as the source code.
-
isFoo = true; #ifdef UNICODE @@ -1335,8 +1173,7 @@ error: text = buff; #endif
- becomes: -
+ becomes:isFoo = true; #ifdef UNICODE text = wideBuff; @@ -1346,13 +1183,12 @@ error:
- -
+
--indent-col1-comments / -Y
- Indent C++ comments beginning in column one. By default C++ comments beginning in column one are not indented.
- This option will allow the comments to be indented with the code.
-
void Foo()\n" { @@ -1362,19 +1198,17 @@ error: }
- becomes: -
+ becomes:void Foo()\n" { - // comment + // comment if (isFoo) bar(); }
- -
+
--min-conditional-indent=# / -m#
Set the minimal indent that is added when a header is built of multiple lines. This indent helps to easily separate
@@ -1386,13 +1220,13 @@ error:
1 - indent at least one additional indent.
2 - indent at least two additional indents.
3 - indent at least one-half an additional indent. This is intended for large indents (e.g. 8).
- The default value is 2, two additional indents.
-
// default setting makes this non-bracketed code clear if (a < b || c > d) foo++; + // but creates an exaggerated indent in this bracketed code if (a < b || c > d) @@ -1401,12 +1235,13 @@ if (a < b }
- becomes (when setting --min-conditional-indent=0
):
-
--min-conditional-indent=0
):
// setting makes this non-bracketed code less clear if (a < b || c > d) foo++; + // but makes this bracketed code clearer if (a < b || c > d) @@ -1416,39 +1251,36 @@ if (a < b
- -
+
--max-instatement-indent=# / -M#
Set the maximum of # spaces to indent a continuation line. The
- #
- indicates a number of columns and must not be greater than 120.
- If no # is set, the default value of 40 will be
- used. A maximum of less than two indent lengths will be ignored. This option will prevent continuation lines from
- extending too far to the right. Setting a larger value will allow the code to be extended further to the right.
-
fooArray[] = { red, green, blue }; + fooFunction(barArg1, barArg2, barArg3);
- becomes (with larger value): -
+ becomes (with larger value):fooArray[] = { red, green, blue }; + fooFunction(barArg1, barArg2, barArg3);
- -
+
--break-blocks / -f
- Pad empty lines around header blocks (e.g. 'if
', 'for
', 'while
'...).
-
if
', 'for
',
+ 'while
'...).
isFoo = true; if (isFoo) { @@ -1469,25 +1301,24 @@ if (isFoo) { isBar = false;
- becomes: -
+ becomes:isFoo = true; + if (isFoo) { bar(); } else { anotherBar(); } + isBar = false;
- -
+
--break-blocks=all / -F
Pad empty lines around header blocks (e.g. 'if
', 'for
', 'while
'...). Treat
- closing header blocks (e.g. 'else
', 'catch
') as stand-alone blocks.
-
else
', 'catch
') as stand-alone blocks.
isFoo = true; if (isFoo) { @@ -1498,82 +1329,89 @@ if (isFoo) { isBar = false;
- becomes: -
+ becomes:isFoo = true; + if (isFoo) { bar(); - + } else { anotherBar(); } + isBar = false;
- -
+
- --pad-oper / -p
-
- Insert space padding around operators. Any end of line comments will remain in the original column, if possible.
- Note that there is no option to unpad. Once padded, they stay padded.
-
--pad-oper / -p
if (foo==2) a=bar((b-c)*a,d--);
- becomes: -
+ becomes:if (foo == 2) - a = bar((b - c) * a, d--); + a = bar((b - c) * a, d--);
- -
+ +
+ --pad-comma / -xg
+ Insert space padding after commas. This is not needed if pad-oper is used. Any end of line comments will
+ remain in the original column, if possible. Note that there is no option to unpad. Once padded, they
+ stay padded.
if (isFoo(a,b) + bar(a,b); ++
+ becomes:
+if (isFoo(a, b) + bar(a, b); ++
+
--pad-paren / -P
Insert space padding around parenthesis on both the outside and the inside.
- Any end of line comments will remain in the original column, if possible.
-
if (isFoo((a+2), b)) bar(a, b);
- becomes: -
+ becomes:if ( isFoo ( ( a+2 ), b ) ) bar ( a, b );
- -
+
--pad-paren-out / -d
Insert space padding around parenthesis on the outside only. Parentheses that are empty will
not be padded. Any end of line comments will remain in the original column, if possible. This can be used with
- unpad-paren below to remove unwanted spaces.
-
if (isFoo((a+2), b)) bar(a, b);
- becomes: -
+ becomes:if (isFoo ( (a+2), b) ) bar (a, b);
- -
+
--pad-first-paren-out / -xd
@@ -1581,108 +1419,94 @@ isBar = false;
only. Parentheses that are empty will not be padded. Any end of line comments will remain in the original column,
if possible. This can be used with unpad-paren below to remove unwanted spaces. If used with pad‑paren or
pad‑paren‑out, this option will be ignored. If used with pad‑paren‑in, the result will
- be the same as pad‑paren.
-
if (isFoo((a+2), b)) bar(a, b);
- becomes: -
+ becomes:if (isFoo ((a+2), b)) bar (a, b);
- -
+
--pad-paren-in / -D
Insert space padding around parenthesis on the inside only. Any end of line comments will remain
- in the original column, if possible. This can be used with unpad-paren below to remove unwanted spaces.
-
if (isFoo((a+2), b)) bar(a, b);
- becomes: -
+ becomes:if ( isFoo( ( a+2 ), b ) ) bar( a, b );
- -
+
--pad-header / -H
Insert space padding between a header (e.g. 'if
', 'for
', 'while
'...)
and the following paren. Any end of line comments will remain in the original column, if possible. This can
- be used with unpad-paren to remove unwanted spaces.
-
if(isFoo((a+2), b)) bar(a, b);
- becomes: -
+ becomes:if (isFoo((a+2), b)) bar(a, b);
- -
+
--unpad-paren / -U
Remove extra space padding around parenthesis on the inside and outside. Any end of line comments will remain
in the original column, if possible. This option can be used in combination with the paren padding options pad‑paren
,
pad‑paren‑out
, pad‑paren‑in
, and pad‑header
- above. Only padding that has not been requested by other options will be removed.
-
For example, if a source has parens padded on both the inside and outside, and you want inside only. You need
- to use unpad-paren
to remove the outside padding, and pad‑paren‑in
to retain
- the inside padding. Using only pad‑paren‑in
would not remove the outside padding.
-
unpad-paren
to remove the outside padding, and pad‑paren‑in
to
+ retain the inside padding. Using only pad‑paren‑in
would not remove the outside
+ padding.
if ( isFoo( ( a+2 ), b ) ) bar ( a, b );
- becomes (with no padding option requested): -
+ becomes (with no padding option requested):if(isFoo((a+2), b)) bar(a, b);
- -
+
--delete-empty-lines / -xe
Delete empty lines within a function or method. Empty lines outside of functions or methods are NOT deleted. If
used with break-blocks or break-blocks=all it will delete all lines EXCEPT the lines added by the break-blocks
- options.
-
void Foo() { - + foo1 = 1; - + foo2 = 2; - + }
- becomes: -
+ becomes:void Foo()
{
foo1 = 1;
@@ -1691,33 +1515,27 @@ isBar = false;
- -
+
--fill-empty-lines / -E
- Fill empty lines with the white space of the previous line.
-
- -
+
-
- --align-pointer=type / -k1
+ --align-pointer=type / -k1
--align-pointer=middle / -k2
--align-pointer=name / -k3
Attach a pointer or reference operator (*, &, or ^) to either the variable type (left) or variable name (right),
or place it between the type and name (middle). The spacing between the type and name will be preserved, if possible.
This option is for C/C++, C++/CLI, and C# files. To format references separately use the following align-reference
- option.
-
char* foo1; char & foo2; String ^s1;
- becomes (with align-pointer=type): -
+ becomes (with align-pointer=type):char* foo1; char& foo2; String^ s1;@@ -1727,8 +1545,7 @@ String^ s1; char & foo2; String ^s1;
- becomes (with align-pointer=middle): -
+ becomes (with align-pointer=middle):char * foo1; char & foo2; String ^ s1;@@ -1738,18 +1555,15 @@ String ^ s1; char & foo2; String ^s1;
- becomes (with align-pointer=name): -
+ becomes (with align-pointer=name):char *foo1; char &foo2; String ^s1;
- -
+
-
- --align-reference=none / -W0
+ --align-reference=none / -W0
--align-reference=type / -W1
--align-reference=middle / -W2
--align-reference=name / -W3
@@ -1757,32 +1571,27 @@ String ^s1;
This option will align references separate from pointers. Pointers are not changed by this option. If pointers
and references are to be aligned the same, use the previous align-pointer option. The option align-reference=none
will not change the reference alignment. The other options are the same as for align-pointer. This option is for
- C/C++, C++/CLI, and C# files.
-
char &foo1;
- becomes (with align-reference=type): -
+ becomes (with align-reference=type):char& foo1;
char& foo2;
- becomes (with align-reference=middle): -
+ becomes (with align-reference=middle):char & foo2;
char& foo3;
- becomes (with align-reference=name): -
+ becomes (with align-reference=name):char &foo3;
- -
+void Foo(bool isFoo) { if (isFoo) { bar(); - } else { + } else { anotherBar(); - } + } }
- becomes (a broken 'else'): -
+ becomes (a broken 'else'):void Foo(bool isFoo) { if (isFoo) { bar(); - } + } else { anotherBar(); - } + } }
- -
+
--break-elseifs / -e
Break "else if" header combinations into separate lines. This option has no effect if keep-one-line-statements
- is used, the "else if" statements will remain as they are.
-
- If this option is NOT used, "else if" header combinations will be placed on a single line. -
+ If this option is NOT used, "else if" header combinations will be placed on a single line.if (isFoo) { bar(); @@ -1841,110 +1645,96 @@ else if (isFoo2()) { }
- becomes: -
+ becomes:if (isFoo) { bar(); } else if (isFoo1()) { bar1(); - } - else + } + else if (isFoo2()) { bar2(); }
- -
+
--add-brackets / -j
Add brackets to unbracketed one line conditional statements (e.g. 'if
', 'for
',
'while
'...). The statement must be on a single line. The brackets will be added according to
the currently requested predefined style or bracket type. If no style or bracket type is requested the brackets
- will be attached. If --add-one-line-brackets is also used the result will be one line brackets.
-
if (isFoo) isFoo = false;
- becomes: -
+ becomes:if (isFoo) { isFoo = false; }
- -
+
--add-one-line-brackets / -J
Add one line brackets to unbracketed one line conditional statements (e.g. 'if
', 'for
',
'while
'...). The statement must be on a single line. The option implies --keep-one-line-blocks and
- will not break the one line blocks.
-
if (isFoo) isFoo = false;
- becomes: -
+ becomes:if (isFoo) - { isFoo = false; } + { isFoo = false; }
- -
+
--remove-brackets / -xj
Remove brackets from conditional statements (e.g. 'if
', 'for
', 'while
'...).
The statement must be a single statement on a single line. If --add-brackets or --add-one-line-brackets is also
- used the result will be to add brackets. Brackets will not be removed from "One True Brace Style", --style=1tbs.
-
if (isFoo) { isFoo = false; }
- becomes: -
+ becomes:if (isFoo) isFoo = false;
- -
+
--keep-one-line-blocks / -O
- Don't break one-line blocks.
-
if (isFoo) { isFoo = false; cout << isFoo << endl; }
- remains unchanged. -
+ remains unchanged.- -
+
--keep-one-line-statements / -o
- Don't break complex statements and multiple statements residing on a single line.
-
if (isFoo) { @@ -1952,217 +1742,210 @@ else }
- remains unchanged. -
+ remains unchanged.if (isFoo) DoBar();
- remains unchanged. -
+ remains unchanged.- -
+
--convert-tabs / -c
Converts tabs into spaces in the non-indentation part of the
line. The number of spaces inserted will maintain the spacing of the tab. The current setting for spaces per tab
is used. It may not produce the expected results if convert-tabs is used when changing spaces per tab. Tabs are
- not replaced in quotes.
-
- -
+
--close-templates / -xy
Closes whitespace in the angle brackets of template definitions. Closing the ending angle brackets is now allowed
- by the C++11 standard. Be sure your compiler supports this before making the changes.
-
Stack< int,List< int > > stack1;
- becomes: -
+ becomes:Stack<int,List<int>> stack1;
- -
+
--remove-comment-prefix / -xp
Remove the preceding '*' in a multi-line comment that begins a line. A trailing '*', if present, is also removed.
Text that is less than one indent is indented to one indent. Text greater than one indent is not changed. Multi-line
comments that begin a line but without the preceding '*' are indented to one indent for consistency. This can
slightly modify the indentation of commented out blocks of code. Lines containing all '*' are left unchanged.
- Extra spacing is removed from the comment close '*/'.
-
/* * comment line 1 * comment line 2 */
- becomes: -
+ becomes:/* comment line 1 comment line 2 */
- -
+
-
- --max-code-length=# / -xC#
+
--max-code-length=# / -xC#
- --break-after-logical / -xL
-
+ --break-after-logical / -xL
The option max‑code‑length will break a line if the code exceeds #
characters. The valid values are 50 thru 200. Lines without logical conditionals will break on a logical conditional
- (||, &&, ...), comma, paren, semicolon, or space.
-
Some code will not be broken, such as comments, quotes, and arrays. If used with keep‑one‑line‑blocks or add-one-line-brackets the blocks will NOT be broken. If used with keep‑one‑line‑statements the statements will be broken at a semicolon if the line goes over the maximum length. If there is no available break point within the max code length, the line will be broken at the first available break point after the max - code length. -
+ code length.By default logical conditionals will be placed first on the new line. The option break‑after‑logical will cause the logical conditionals to be placed last on the previous line. This option has no effect without - max‑code‑length. -
+ max‑code‑length.if (thisVariable1 == thatVariable1 || thisVariable2 == thatVariable2 || thisVariable3 == thatVariable3) bar();
- becomes: -
+ becomes:if (thisVariable1 == thatVariable1 || thisVariable2 == thatVariable2 || thisVariable3 == thatVariable3) bar();
- becomes (with break‑after‑logical): -
+ becomes (with break‑after‑logical):if (thisVariable1 == thatVariable1 || thisVariable2 == thatVariable2 || thisVariable3 == thatVariable3) bar();
- -
+
--mode=c
--mode=cs
--mode=java
- Indent a C type, C#, or Java file. C type files are C, C++, C++/CLI, and Objective-C. The option is usually
+ Indent a C type, C#, or Java file. C type files are C, C++, C++/CLI, and Objective-C. The option is usually
set from the file extension for each file. You can override the setting with this entry. It will be used for all
files regardless of the file extension. It allows the formatter to identify language specific syntax such as C++
- classes, templates, and keywords.
-
- -
++ These options are effective for Objective‑C files only. The paren padding options will still apply to the + Objective-C method prefix and return type unless overridden by the following options.
Because of the longer indents sometimes needed for Objective‑C, the option "max-instatement-indent" may - need to be increased. If you are not getting the paren and square bracket alignment you want, try increasing this - value. The option is described in the "Indentation Options" section. -
+ need to be increased. If you are not getting the paren and square bracket alignment you want try increasing this + value. The option is described in the "Indentation Options" section. +
+ --pad-method-prefix / -xQ
+ Insert space padding after the '-' or '+' Objective‑C method prefix. This will add
+ exactly one space. Any additional spaces will be deleted. This option takes precedence over the pad-paren
+ options.
-(void)foo1; ++(void)foo2;+
+ becomes:
+- (void)foo1; ++ (void)foo2;+
+
+
+ --unpad-method-prefix / -xR
+ Remove all space padding after the '-' or '+' Objective‑C method prefix.
+ This option will be ignored if used with pad‑method‑prefix. It takes precedence over the pad-paren
+ options.
- (void)foo1; ++ (void)foo2;+
+ becomes:
+-(void)foo1; ++(void)foo2;+
+
+
+ --pad-return-type / -xq
+ Insert space padding after the Objective‑C return type. This will add exactly one
+ space. Any additional spaces will be deleted. This option takes precedence over the pad-paren options.
-(void)foo1; ++(void)foo2;+
+ becomes:
+-(void) foo1; ++(void) foo2;+
+
+
+ --unpad-return-type / -xr
+ Remove all space padding after the Objective‑C return type. This option
+ will be ignored if used with pad‑return‑type. It takes precedence over the pad-paren options.
-(void) foo1; ++(void) foo2;+
+ becomes:
+-(void)foo1; ++(void)foo2;+
+
--align-method-colon / -xM
- Align the colons in Objective‑C method declarations. This option is effective for Objective‑C
- files only.
-
-(void)deleteKey:(id)key atIndex:(int)index ofNode:(Node*)node;
- becomes: -
+ becomes:-(void)deleteKey:(id)key atIndex:(int)index ofNode:(Node*)node;
- -
-
- --pad-method-prefix / -xQ
- Insert space padding after the '-' or '+' Objective‑C method prefix. This will add exactly one space. Any
- additional spaces will be deleted. This option is effective for Objective‑C files only.
-
-(void)foo1; -+(void)foo2;-
- becomes: -
-- (void)foo1; -+ (void)foo2;-
- -
-
- --unpad-method-prefix / -xR
- Remove all space padding after the '-' or '+' Objective‑C method prefix. If used with pad‑method‑prefix,
- this option will be ignored. This option is effective for Objective‑C files only.
-
- (void)foo1; -+ (void)foo2;-
- becomes: -
--(void)foo1; -+(void)foo2;-
- -
+
-
- --pad-method-colon=none / -xP0
+ --pad-method-colon=none / -xP0
--pad-method-colon=all / -xP1
--pad-method-colon=after / -xP2
--pad-method-colon=before / -xP3
Add or remove space padding before or after the colons in an Objective‑C method call. These options will
- pad exactly one space. Any additional spaces will be deleted. Colons immediately preceding a paren will not be
- padded. This option is effective for Objective‑C files only.
-
- with pad-method-colon=none: -
+ with pad-method-colon=none:[node insertKey:key];
- with pad-method-colon=all: -
+ with pad-method-colon=all:[node insertKey : key];
- with pad-method-colon=after: -
+ with pad-method-colon=after:[node insertKey: key];
- with pad-method-colon=before: -
+ with pad-method-colon=before:[node insertKey :key];
- -
+- These are non-formatting options available for the command-line. They can also be included in an options file. -
+ These are non-formatting options available for the command-line. They can also be included in an options + file.
--suffix=####
Append the suffix #### instead of '.orig' to original file name (e.g. --suffix=.bak
).
If this is to be a file extension, the dot '.' must be included. Otherwise the suffix will be appended to the
- current file extension.
-
--suffix=none / -n
- Do not retain a backup of the original file. The original file is purged after it is formatted.
-
--recursive / -r / -R
For each directory in the command line, process all subdirectories recursively. When using the recursive option
the file name statement should contain a wildcard. Linux users should place the file path and name in double quotes
so the shell will not resolve the wildcards (e.g. "$HOME/src/*.cpp"). Windows users should place the file path
- and name in double quotes if the path or name contains spaces.
-
--dry-run
- Perform a trial run with no changes made to the files. The report will be output as usual.
-
--exclude=####
- Specify a file or sub directory #### to be excluded from processing.
-
Excludes are matched from the end of the file path. An exclude option of "templates" will exclude ALL directories named "templates". An exclude option of "cpp/templates" will exclude ALL "cpp/templates" directories. You may - proceed backwards in the directory tree to exclude only the required directories. -
+ proceed backwards in the directory tree to exclude only the required directories.- Specific files may be excluded in the same manner. An exclude option of "default.cpp" will exclude ALL files named - "default.cpp". An exclude option of "python/default.cpp" will exclude ALL files named "default.cpp" contained - in a "python" subdirectory. You may proceed backwards in the directory tree to exclude only the required files. -
+ Specific files may be excluded in the same manner. An exclude option of "default.cpp" will exclude ALL files + named "default.cpp". An exclude option of "python/default.cpp" will exclude ALL files named "default.cpp" + contained in a "python" subdirectory. You may proceed backwards in the directory tree to exclude only the + required files.Wildcards are NOT allowed. There may be more than one exclude statement. The file path and name may be placed - in double quotes (e.g. ‑‑exclude="foo bar.cpp"). -
+ in double quotes (e.g. ‑‑exclude="foo bar.cpp").
--ignore-exclude-errors / -i
Allow processing to continue if there are errors in the "exclude=###" options.
This option lets the excludes for several projects be entered in a single option file. This option may be placed
in the same option file as the excludes. It will display the unmatched excludes. The following option will not
- display the unmatched excludes.
-
--ignore-exclude-errors-x / -xi
Allow processing to continue if there are errors in the "exclude=###" options.
This option lets the excludes for several projects be entered in a single option file. This option may be placed
in the same option file as the excludes. It will NOT display the unmatched excludes. The preceding option will
- display the unmatched excludes.
-
--errors-to-stdout / -X
Print errors to standard-output rather than to standard-error.
This option should be helpful for systems/shells that do not have a separate output to standard-error, such as
- in Windows95.
-
--preserve-date / -Z
Preserve the original file's date and time modified. The time modified will be changed a few micro seconds to
- force the changed files to compile. This option is not effective if redirection is used to rename the input file.
-
--verbose / -v
- Verbose display mode. Display optional information, such as release number and statistical data.
-
--formatted / -Q
Formatted files display mode. Display only the files that have been formatted. Do not display files that
- are unchanged.
-
--quiet / -q
- Quiet display mode. Suppress all output except error messages.
-
-
- --lineend=windows / -z1
+ --lineend=windows / -z1
--lineend=linux / -z2
--lineend=macold / -z3
Force use of the specified line end style. Valid options are windows (CRLF), linux (LF), and macold (CR). MacOld
style is the format for Mac OS 9 and earlier. OS X uses the Linux style. If one of these options
- is not used the line ends will be determined automatically from the input file.
-
When redirection is used on Windows the output will always have Windows line ends. This option - will be ignored. -
+ will be ignored.- -
+
--options=####
Specify an options file #### to read and use. It must contain a file path for the file. This will allow the file
- name to be changed from astylerc or .astylerc.
-
--options=none
- Disable the default options file. Only the command-line parameters will be used.
-
--ascii / -I
The displayed output will be ascii characters only. The text will be displayed in English and numbers will not
- be formatted. The short option must be by itself, it cannot be concatenated with other options.
-
--version / -V
- Print version number and quit. The short option must be by itself, it cannot be concatenated with other options.
-
--help / -h / -?
- Print a help message and quit. The short option must be by itself, it cannot be concatenated with other options.
-
--html / -!
Open the HTML help
file "astyle.html" in the default browser and quit. The short option must be by itself, it
cannot be concatenated with other options. The documentation must be installed in the standard install path (/usr/share/doc/astyle/html
- for Linux or %PROGRAMFILES%\AStyle\doc for Windows). If installed to a different path use html=###.
-
--html=####
Open a HTML help file in the default browser using the file path #### and quit. A HTML file other than "astyle.help"
may be specified. The path may include a directory path and a file name, or a file name only (e.g. html=install.html).
If only a file name is used it is assumed to be in the standard install path (/usr/share/doc/astyle/html
for Linux or %PROGRAMFILES%\AStyle\doc for Windows). In both cases the file name must include the html extension.
- File paths containing spaces must be enclosed in quotes.
-
On Linux the HTML file is opened using the script "xdg-open" from the install package "xdg-utils". This should - be installed - by default on most distributions. -
+ be installed by default on most distributions.Any HTML file can be opened by this option. The files you are likely to need are astyle.html (the default), install.html, - and index.html. -
+ and index.html.- -
+
-
- ![]() ![]() |
- ENJOY !!! | -
-
- |
-
+
+
+
- -
+- -
- - - - - - - - - - + diff --git a/doc/favicon.ico b/doc/favicon.ico new file mode 100644 index 0000000..0de820b Binary files /dev/null and b/doc/favicon.ico differ diff --git a/doc/install.html b/doc/install.html index a34feff..70c397e 100644 --- a/doc/install.html +++ b/doc/install.html @@ -1,6 +1,6 @@ - + - +- -
+ -- Linux Version -
+ Linux Version- GCC Compiler -
+ GCC Compiler + Clang Compiler- Clang Compiler -
+ Intel Compiler- Intel Compiler -
+ Other Makefile Targets- Mac OS X Version -
+ Mac OS Version- Xcode -
+ Xcode- Makefile -
+ Makefile- Windows Version -
+ Windows Version + Precompiled Executable + Visual C++ Compiler- Other Compilers -
+ Other Compilers- Compiler Options -
+ Compiler Options -- astyle_x.x_linux.tar.gz is the Linux version of Artistic Style. It contains the source code, documentation, - and makefiles. The Linux Version compile instructions below give information for compiling the source code. -
+ astyle_x.x_linux.tar.gz is the Linux version of Artistic Style. It contains the source code, + documentation, and makefiles. The Linux Version compile instructions below give information for compiling the + source code.- astyle_x.x_macosx.tar.gz is the Mac OS X version of Artistic Style. It contains the source code, documentation, - Xcode project files, and a makefile. The Mac OS X Version compile instructions below give information for compiling - the source code. -
+ astyle_x.x_macos.tar.gz is the Mac OS version of Artistic Style. It contains the source code, + documentation, Xcode project files, and a makefile. The Mac OS Version compile instructions below give information + for compiling the source code.- astyle_x.x_windows.zip is the Windows version of Artistic Style. It contains the source code, documentation, - Visual C project files, and an executable. The Windows Version compile instructions below give information for - compiling the source code. -
+ astyle_x.x_windows.zip is the Windows version of Artistic Style. It contains the source code, + documentation, Visual C project files, and an executable. The Windows Version compile instructions below give + information for compiling the source code.Only one platform is supported in each distribution package. If you use Artistic Style on more than one platform you will need to download packages for each platform. The main difference in platforms is the build directories and the line endings. Most compilers and development packages will accept any type of line ending. The source - code and documentation are the same for all distributions. -
+ code and documentation are the same for all distributions. -- To compile using the GCC compiler you must have GCC (3.1 or better) installed. -
+ To compile using the GCC compiler you must have GCC (3.1 or better) installed.The build has no autoconf dependency. To build the Artistic Style configurations use the makefile located in the astyle/build/gcc directory. The executables will be in the astyle/build/gcc/bin directory. To build the command - line configuration enter the following: -
+ line configuration enter the following:cd astyle/build/gcc
make
To build the other astyle configurations you can enter the file name or a symbolic name. Entering "make astyle" or "make release" will build the command line configuration. Following are the symbolic names and file names (in - parens) of the various configurations: -
+ parens) of the various configurations:The following Java shared library builds are separate from the above. They include a Java Native Interface (JNI) and require that the Java Development Kit (JDK) be installed. The environment variable JAVA_HOME should be defined. It defines the install directory for the JDK. The makefile also has default install directories for Java 5 and - 6. If the compile cannot find the file jni.h, either set the variable or change the value in the makefile. -
+ 6. If the compile cannot find the file jni.h, either set the variable or change the value in the + makefile.More than one configuration can be built at the same time. For example, to build all the release configurations - enter: -
+ enter:cd astyle/build/gcc+
make release shared static
+ The Other Makefile Targets section contains additional target + options.
-- The following makefile options are available for GCC, Clang, Intel, and Mac. -
-- Removes the object and executable files for all configurations. -
-- To remove the files for all configurations: -
-make clean --
- Removes the object files for all configurations. The executables will not be removed. -
-- To remove only the object files for all configurations: -
-make cleanobj --
- Installs the - astyle executable and documentation files. The default is /usr/bin for the executable and /usr/share/doc/astyle - for the documentation. You must have the appropriate permissions to use install. -
-- To install the astyle to the default directories: -
-sudo make install --
- To install astyle to a different bin directory set a value for the macro $(prefix). For example to install the - executable to a user's home directory (/home/user/bin): -
-sudo make prefix=$HOME install --
- Uninstalls the executable and documentation. You must have the appropriate permissions to use uninstall. -
-- To uninstall astyle from the default directories: -
-sudo make uninstall --
- To uninstall the files from a different directory set a value for the macro $(prefix). For example to uninstall - the files from a user's home directory (/home/user): -
-sudo make prefix=$HOME uninstall --
- NOTE: The uninstall option will NOT remove the .astylerc files from the users home directories. The files must - be removed individually for each user. -
- -- The Clang Compiler release 2.9.11 has a problem finding object files on - some distributions (Ubuntu based). There is a script file, copyfiles.sh, that will copy three object files to - the clang build directory so they can be linked. The directory may need to be modified for your distribution. - Or, you may not need it at all. This problem has been fixed in version 3.0. -
Clang has a static analyzer that finds potential bugs in C/C++ and Objective-C programs. It can be run as a standalone tool from the command-line, and runs in tandem with a build. There is a script file, analyze.sh, that will run - the analysis on Artistic Style. -
+ the analysis on Artistic Style.The build has no autoconf dependency. To build the Artistic Style configurations use the makefile located in the astyle/build/clang directory. The executables will be in the astyle/build/clang/bin directory. To build the command - line configuration enter the following: -
+ line configuration enter the following:cd astyle/build/clang
make
To build the other astyle configurations you can enter the file name or a symbolic name. The configurations for Clang are the same as for the GCC compiler. More than one configuration can be - built at the same time. For example, to build all the release configurations enter: -
+ built at the same time. For example, to build all the release configurations enter:cd astyle/build/clang
make release shared static
- The Other Makefile Options are the same as for the GCC compiler. -
+ The Other Makefile Targets section contains additional target + options. -These procedures and the makefile are for recent versions of the compiler. They may not work for earlier versions. - Instructions for your compiler are in the compiler documentation file "get_started_lc.htm". -
+ Instructions for your compiler are in the compiler documentation file "get_started_lc.htm".To compile the source there are environment variables that must be set by running the compiler environment script compilervars.sh (or compilervars.csh) with an argument that specifies the target architecture. If this has not been done already enter: "source <install-dir>/bin/compilervars.sh <arg>", where <install-dir> is the directory where the compiler is installed and <arg> is ia32 or intel64. If this is not done "make" will display an error message "*** The compiler environment - variables are not set." On an Intel x64 platform installed in the default directory the instruction would be -
+ variables are not set." On an Intel x64 platform installed in the default directory the instruction would + besource /opt/intel/bin/compilervars.sh intel64
The build has no autoconf dependency. To build the Artistic Style configurations use the makefile located in the astyle/build/intel directory. The output executables will be in the astyle/build/intel/bin directory. To build - the command line configuration enter the following: -
+ the command line configuration enter the following:cd astyle/build/intel
make
To build the other astyle configurations you can enter the file name or a symbolic name. The configuration names for Intel are the same as for the GCC compiler. More than one configuration can be - built at the same time. For example, to build the entire debug configurations enter: -
+ built at the same time. For example, to build the entire debug configurations enter:cd astyle/build/intel
make debug shareddebug staticdebug
- The Other Makefile Options are the same as for the GCC compiler. -
+ The Other Makefile Targets section contains additional target + options. -+ The following makefile targets are available for GCC, Clang, Intel, and Mac.
+ ++ Removes the object and executable files for all configurations.
++ To remove the files for all configurations:
+make clean ++ +
+ Removes the object files for all configurations. The executables will not be removed.
++ To remove only the object files for all configurations:
+make cleanobj ++ +
+ Installs the + astyle executable and documentation files. The default is /usr/bin for the executable and /usr/share/doc/astyle + for the documentation. You must have the appropriate permissions to use install.
++ To install the astyle to the default directories:
+sudo make install ++
+ To install astyle to a different bin directory set a value for the macro $(prefix). For example to install the + executable to a user's home directory (/home/user/bin):
+sudo make prefix=$HOME install ++ +
+ Uninstalls the executable and documentation. You must have the appropriate permissions to use uninstall.
++ To uninstall astyle from the default directories:
+sudo make uninstall ++
+ To uninstall the files from a different directory set a value for the macro $(prefix). For example to uninstall + the files from a user's home directory (/home/user):
+sudo make prefix=$HOME uninstall ++
+ NOTE: The uninstall option will NOT remove the .astylerc files from the users home directories. The files must + be removed individually for each user.
+ +Artistic Style workspace and project files for the Xcode development environment are available in the "build/xcode" directory. A workspace can be used to build a single project or all the projects. The project files have Debug - and Release configurations. The following projects are available. -
+ and Release configurations. The following projects are available.Only the astyle executable is installed. The library project installs are sent to UninstalledProjects in the Build directory. The following instructions are for the astyle executable and documentation files. The default install directory is /usr/bin for the executable and /usr/share/doc/astyle for the documentation. You must have the appropriate permissions to use install. - If sudo is not used for the install an error will occur during the build. -
+ If sudo is not used for the install an error will occur during the build.- To install the astyle executable to the default directory: -
+ To install the astyle executable to the default directory:cd astyle/build/xcode sudo xcodebuild install -project AStyle.xcodeproj
A script is used to install the documentation - from the same directory. -
+ from the same directory.sudo bash install.sh-
- Uninstalls the executable and documentation. You must have the appropriate permissions to use uninstall. -
+ Uninstalls the executable and documentation. You must have the appropriate permissions to use uninstall.- A script is used to uninstall astyle and the documentation: -
+ A script is used to uninstall astyle and the documentation:sudo bash uninstall.sh
NOTE: The uninstall option will NOT remove the .astylerc files from the users home directories. The files must - be removed individually for each user. -
+ be removed individually for each user.- The Artistic Style makefile compile uses the OS X "Command Line Tools". If you have Xcode 4.3 or newer + The Artistic Style makefile compile uses the Mac OS "Command Line Tools". If you have Xcode 4.3 or newer the command line tools, such as "make", are NOT installed by default. They must be downloaded and installed separately. Once everything is successfully installed you should see "make" and other command line developer - tools in /usr/bin. -
+ tools in /usr/bin.The build has no autoconf dependency. To build the Artistic Style configurations use the makefile located in the astyle/build/mac directory. The executables will be in the astyle/build/mac/bin directory. To build the command - line configuration enter the following: -
+ line configuration enter the following:cd astyle/build/mac
make
To build the other astyle configurations you can enter the file name or a symbolic name. The configurations for Mac are the same as for the Linux GCC compiler. More than one configuration can be - built at the same time. For example, to build all the release configurations enter: -
+ built at the same time. For example, to build all the release configurations enter:cd astyle/build/mac
make release shared static
- The Other Makefile Options are the same as for the Linux GCC compiler. -
+ The Other Makefile Targets section contains additional target + options. -In addition to the source files, the Windows distribution package contains an Artistic Style Win32 executable - (AStyle.exe). If you prefer to compile the executable yourself follow the following instructions. -
+ (AStyle.exe). If you prefer to compile the executable yourself follow the following instructions. -- There are configuration and project files for - several versions of the Visual C compiler. Open the AStyle configuration - file in the appropriate "build" directory. All project files have Debug, Release and Static configurations. + There are + solution and project files for + several versions of the Visual C compiler. Open an Artistic Style solution + file in the appropriate "build" directory. All projects have Debug, Release and Static configurations. Debug file output will be in the "debug" directory. Release file output will be in the "bin" - directory. Static file output will be in the "binstatic" directory. The following solution files are available. -
+ directory. Static file output will be in the "binstatic" directory. The following solution files are + available.- To use other compilers a project file must be built using a development environment. -
+ To use other compilers a project file must be built using a development environment.No macro definitions are required to compile the executable. To compile as a static or shared (dynamic) library - define the macro ASTYLE_LIB. To compile a Java shared (dynamic) library define the macro ASTYLE_JNI. The - option ASTYLE_NO_EXPORTS is sometimes needed for static libraries to prevent compiler error and warning + define the macro ASTYLE_LIB. To compile a Java shared (dynamic) library define the macro ASTYLE_JNI. The + option ASTYLE_NO_EXPORTS is sometimes needed for static libraries to prevent compiler error and warning messages. Use the appropriate compiler and linker options to compile the static or shared library. Add debug - options to compile the debug versions. -
+ options to compile the debug versions.Artistic Style is a small program and it is best to optimize for speed. The debug configurations are not usually optimized. To optimize for speed in the release configurations use the macro NDEBUG to remove asserts. If necessary, use an option to activate the C++11 standards (--std=c++0x on GCC and MinGW). Use an - option that allows inline function expansion. Runtime Type Information (RTTI) is NOT needed. Exceptions are not + option that allows inline function expansion. Runtime Type Information (RTTI) is NOT needed. Exceptions are + NOT used. Use whole program optimization if your compiler supports it. There may be other options you can use depending - on the compiler. -
+ on the compiler.- -
+ -
-
-
- -
- - - - - - - - - - + diff --git a/doc/news.html b/doc/news.html index 29bfec9..9f7a947 100644 --- a/doc/news.html +++ b/doc/news.html @@ -1,6 +1,6 @@ - + - +- -
+ + ++ A new option, "pad-comma", will add a space following a comma. The option "pad-oper" + has not been changed and will also add a space following a comma.
++ All spaces before a comma are now removed. Use the "disable formatting" comment tags if there are arrays + with vertical alignment where this is not wanted.
++ New Objective-C options "pad-return-type" and "unpad-return-type" will + add or remove space padding after the Objective-C return type. It is described in the "Objective-C" + section of the documentation.
++ The Objective-C align-method-colon has been changed for method declarations and definitions. + For multi-line arguments when the first keyword is shorter than the others the colons are aligned on the + longest line instead of the first line. The alignment includes room for the indentation. This aligns all colons + after the first line for a better appaerance. Arguments that do not have a short keyword in the first line will + remain the same. This style conforms to the Google Objective-C Style Guide.
++ The Objective-C align-method-colon option is now applied to Objective-C method calls in + addition to method declarations and definitions.
++ Processing for C++14 single-quote digit separators has been added.
++ Translations have been added for Bulgarian, Estonian, Greek, Hungarian, Norwegian, and Romanian. The translations + were done with an automated translation program, Google Translate, so they may not be the best translation possible. + The translations are at the end of ASLocalizer.cpp in the form of an English-Translation pair. If you correct + a translation, send the source as a bug report and it will be included in the next release. To add a language, + see "Internationalization" in the "General Information" section of the documentation.
++ The C# example in the Developer Information has been updated. Objects for the AStyle callback functions are no + longer required. These have been removed and the delegates used instead.
++ There is a new C# example in the Developer Information that loads the AStyle shared library using explicit linking. + This allows the shared library name to be changed so that a program compiled with "Any CPU" can load + either a 32-bit or 64-bit shared library.
++
+ ++ In order to be used on both Linux and Windows, the ASLocalizer.cpp UTF-8 file in Artistic Style does not + contain a Byte Order Mark (BOM). With Visual Studio 2015 there has been a change in how UTF-8 files + without a BOM are processed. The new procedure is described + here. + It affects only the language translations in the ".exe" file. The shared libraries and static libraries + are not affected. It is necessary only if you are unsin a translation other than English.
+ ++ In addition to the "auto detect..." option in Tools > Options... > Text Editor > General, an + additional compiler option is required. The option "/source‑charset:utf‑8" must be added + to the project properties at C++ > Command Line, Additional Options. Since the non‑unicode files in Artistic + Style are ASCII, the option can be applied to the entire project instead of just one file. This option has been + added in the files distributed with Artistic Style. There is also a new "/validate‑charset" option, + which gets turned on automatically with the above option. This switch enables the validation of the UTF-8 input + files.
++ This compiler option was not available until Update 2 of Visual Studio. If you are using an earlier version of + 2015, a BOM should be added to the file using File > "Advanced Save Options...". Change the encoding + to "Unicode (UTF-8 with signature) - Codepage 65001".
++ In the above "Visual C++ Team Blog" Microsoft mentions that in a future major release of the compiler, + they would like to change default handling of BOM-less files to assume UTF-8.
+ ++ The Artisic Style software license has changed. It is now under the MIT license. This is a permissive license + which can be used in proprietory software and does NOT require modified Artistic Style source code be made available. + It is compatable with the GNU General Public License (GPL) and most other software licenses. The change was made + to remove restrictions on using the software and to make it available for any project that wants to + use it.
++ If there are problems with the license change send an email to Artistic Style and its use will be approved on + a individual basis.
+ ++ Visual Studio 2013 and 2015 have an Edit option "Align Assignments" that will align assignment operators + across multiple lines. There is also an extension named "Code alignment" that will align the code on + other items as well. Other development environments may have something similar. These will selectively align the + data and allow for customization of the format.
++ These options and extensions can be used with Artistic Style. If you choose to do this, the space padding will + be maintained and the alignment will be preserved.
+ ++ The Microsoft Clang Compiler is available starting with Visual Studio 2015 Update 2. It is usually used for Android + or iOS support but the CodeGen support can be used with Windows. It will require modification of the Visual Studio + 2015 project files.
++ The Clang compiler can be installed from the Visual Studio 2015 install program by selecting the "Clang + with Microsoft CodeGen" option. If Visual Studio 2015 Update 2 or 3 is already installed, Clang can be installed + by selecting File > New > Project > Visual C++ > Cross Platform, select "Install Clang with Microsoft + CodeGen".
++ To use Clang open a Visual Studio 2015 AStyle Solution. Make the following change to all configurations:
++ Make sure to hit "Apply" before editing other properties to let the project system load the corresponding + toolset definition.
++ The Update 2 and 3 releases do not provide any support for automatic migration of values between Visual Studio + 2015 and Clang. The invalid properties must be fixed manually manually. These properties may change with + subsequent Visual Studio updates.
++ The properties that need changing in Visual Studio 2015 Update 2 and 3 are:
++ The following is needed if you are building an executable instead of a static or dynamic library. + The properties must be Clang-compatible options which start with "-" instead of "/". + The new opton "/source-charset:utf-8" can NOT be used with Clang. If necessary, remove it from C/C++ + > Command Line > Additional Options.
++ The project should now compile and run.
+ ++ There is a new GUI test program AStyleWx that uses wxWidgets. This replaces the old AStyleWin program. AStyleWx + is multi-platform. It has more features simply because they are easier to implement with wxWidgets.
++ It has download files and a website in a new sub-project directory of Artistic Style. The downloads contain + source code, documentation, and scripts. The Windows download contains an executable. The needed Artistic Style + source files are included.
++ It is licensed under the MIT license. The source code may be used and modified for any purpose you + choose. Developers using Artistic Style in another project may use any part of AStyleWx in their project. The + modified source code does NOT need to be made available to others.
+ ++ The executable in the Windows distribution package is now compiled with a Visual Studio version that will no + longer work on Windows XP. Beginning with Visual Studio 2012, auto-vectorization tries to make loops run + faster by automatically vectorizing the code. Auto-vectorization is on by default, there are no compiler + switches, #pragmas, or hints. But it uses SSE instructions not available in Windows XP. Microsoft ended + support and updates for XP on April 8, 2014, and the usage share percentage continues to decrease.
++ If you are using XP, Artistic Style should be compiled on the XP machine. Compiling on XP with any + compiler should produce an XP executable.
++ To compile on a non-XP machine for use on XP, using a compiler other than Visaul Studio should always + produce an XP executable. Using Vusual Studio 2010 or earlier should always produce an XP executable. If + you are using Visual Studio 2012, 2013, or 2015 on a non-XP machine, do the following for the Artistic Style + configuration you want to use:
++ In newer releases of Visual Studio 2015, the "Universal CRT" files have been moved. There is a + notification at https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/. + To compile using XP there may need to be additional include and library directories added. If the compile gets + errors add the appropriate directories to the project properties.
+ + ++ Thanks to David Faure for their contributions.
Release 2.05.1 (December 2014) is a maintenance release and no new features were added. A list of changes is in +
+ Release 2.05.1 (December 2014) is a maintenance release and no new features were added. A list of changes is in the Release Notes. The following information is for the original 2.05 release.
A new bracket style option, "style=vtk", has been added. It uses indented brackets, like Whitesmith, except opening brackets for classes, functions, and methods are not indented. A complete description of the VTK - style is available at the "Visualization Toolkit" website (http://www.vtk.org/). -
+ style is available at the "Visualization Toolkit" website (http://www.vtk.org/).A new preprocessor indent option "indent-preproc-block" will indent preprocessor block statements one additional indent. The block must be top-level, or included within a namespace, and there are restrictions on what can be indented. - The option is described in the "Indentation Options" section of the documentation. -
+ The option is described in the "Indentation Options" section of the documentation.- A new option, "dry-run", will run Artistic Style without updating the files. The report will be output as usual. -
+ A new option, "dry-run", will run Artistic Style without updating the files. The report will be output as + usual.Formatting of source code may now be disabled for portions of a program by embedding special comment tags in the program. These are described in a new "Disable Formatting" section of the documentation. They work the same as in other formatters. There are tags to disable formatting for a block of code, and a tag to disable formatting - of a single line. This should allow any custom formatting to be retained. -
+ of a single line. This should allow any custom formatting to be retained.The product version number has been added to the filename of shared library (DLL) compiles. This will allow multiple - versions of a shared library on the same system without conflicts. -
+ versions of a shared library on the same system without conflicts.An attribute '__attribute__ ((visibility ("default")))' has been added to exported functions on Linux shared libraries. This allows the option "-fvisibility=hidden" to be used on dynamic library compiles. According to the GNU documentation, "Using this feature can very substantially improve linking and load times of shared object libraries, produce more optimized code, provide near-perfect API export and prevent - symbol clashes. It is strongly recommended that you use this in any shared objects you distribute." -
+ symbol clashes. It is strongly recommended that you use this in any shared objects you distribute."Improvements have been made in the formatting of C++11 uniform initializers (enclosed by brackets). The opening bracket will not be space padded unless it is padded initially. The closing bracket will not be broken from the final line unless it is broken initially. And the known problems with uniform initializers in class constructors - have been fixed. -
+ have been fixed.The Windows compiler definition ASTYLE_NO_VCX (no Visual Studio exports) has been changed to ASTYLE_NO_EXPORTS. - It is sometimes needed for static libraries on other compilers to prevent error and warning messages. -
+ It is sometimes needed for static libraries on other compilers to prevent error and warning messages.- Qt and Boost macros foreach, forever, Q_FOREACH, and Q_FOREVER will now be recognized as headers. -
+ Qt and Boost macros foreach, forever, Q_FOREACH, and Q_FOREVER will now be recognized as headers.The main documentation for Artistic Style is in HTML format. Until now there has not been a way to display it from the astyle console program. A new option, "html" or "-!" will display the help documentation in the default browser. This documentation is more complete than the astyle "help" option. It includes examples, and has an index for easier navigation. Since astyle is typically run from a script this should allow an easy way to access the - documentation. The option is available only from the command line. -
+ documentation. The option is available only from the command line.The new "html" option assumes the documentation is installed in the standard install path. This is /usr/share/doc/astyle/html for Linux and the path %programfiles%\AStyle\doc for Windows. If it is installed to a different directory, use the variation "html=<actual_install_path>astyle.html. This option can also be used to open other HTML files. - More information is in the "Command Line Only" section of the documentation. -
+ More information is in the "Command Line Only" section of the documentation.The "html" option on Linux uses the script "xdg-open" from the install package "xdg-utils" to find the default browser. This should be available on most systems. If it is not available on your system you can file a bug report requesting a change. It would be helpful if you could determine how it is done before filing the report. You can also file a bug report if the documentation is not installed to the above "default" directories. The HTML - documentation takes quite a bit of effort to maintain and I would like to make it easily available. -
+ documentation takes quite a bit of effort to maintain and I would like to make it easily available.The "help" option has been changed to send the output to stdout instead of stderr. This will allow piping and redirection of the output. A common way to use the option on Linux is "astyle --help | less", which - will page the display. The "version" option has also been changed to stdout. -
+ will page the display. The "version" option has also been changed to stdout.A shared library error handler argument has been changed from "char*" to "const char*". In - some cases this may cause compile errors in a user program until the references have been changed. -
+ some cases this may cause compile errors in a user program until the references have been changed.The "Indent Style" topic on Wikipedia states that the "ANSI" style refers to K&R style brackets and not Allman style as used by Artistic Style. The option "style=ansi" is therefore being depreciated and will - be removed in a future release. Use one of the other long options instead (style=allman, style=bsd, or style=break). -
+ be removed in a future release. Use one of the other long options instead (style=allman, style=bsd, or + style=break).Some of the documentation has been removed from the distribution package. It still contains all files needed to - install and run Artistic Style. The included files can be used without an Internet connection. -
+ install and run Artistic Style. The included files can be used without an Internet connection.There are now build files available for Xcode on Mac. The makefile is still available for those who want it. Both now use the LLVM Clang compiler. There has been a change to the makefile debug locations to make them similar to Xcode. The "Install Instructions" have - been updated for both. -
+ been updated for both.- The Python Example in the Developer Information now supports Iron Python. The + The Python Example in the Developer Information now supports Iron Python. The programming instructions are sometimes different since the ctypes module works differently. The example script documents the differences. If you use Python Tools for Visual Studio, it now installs in the Express editions - (beginning with release 2.1). Node.js can also be installed in Visual Studio Express. -
+ (beginning with release 2.1). Node.js can also be installed in Visual Studio Express.The executable in the Windows distribution package is now compiled with Visual Studio 2013 and will no longer - work on XP. If you are using XP, Artistic Style will need to be recompiled on the XP machine. -
+ work on XP. If you are using XP, Artistic Style will need to be recompiled on the XP machine.- A new Visual + A new Visual Studio Community Edition has been released. It is free, combines all of the Express editions into a single - development environment, and allows the addition of Visual Studio extensions. There is an - + development environment, and allows the addition of Visual Studio extensions. There is an + AStyle Extension available for installation. It has a graphic interface, adds menu entries, and can be used from within Visual Studio. To install it search the "Extensions and Updates", "Online" - entry for "astyle". -
+ entry for "astyle".- Thanks to Peter A. Bigot, HyungKi Jeong, David Faure, and Carl Moore for their contributions. -
+ Thanks to Peter A. Bigot, HyungKi Jeong, David Faure, and Carl Moore for their contributions.With a new Artistic Style release some unchanged source files will be formatted because of changes to Artistic - Style. You may want to format your source before making program changes in order to bring it up to date. -
+ Style. You may want to format your source before making program changes in order to bring it up to date.A new programming language, Objective‑C, has been added to Artistic Style. Four new options, "align‑method‑colon", "pad‑method‑colon=", "pad‑method‑prefix", and "unpad‑method‑prefix" have been added to format the methods. The options are described in a new "Objective‑C" section in the documentation. - These new options affect only Objective‑C source code. They have no effect on the other programming languages. -
+ These new options affect only Objective‑C source code. They have no effect on the other programming + languages.Because of the longer continuation indents sometimes needed for Objective‑C, the option "max-instatement-indent" may need to be increased. If you are not getting the paren and square bracket alignment you want, try increasing - this value. The default minimum is 40 and the maximum is 120. -
+ this value. The default minimum is 40 and the maximum is 120.A new bracket style option, "style=google", has been added. It uses attached brackets and indents the class access modifiers one-half indent. A complete description of the Google style is available at the google‑styleguide website (https://code.google.com/p/google-styleguide/). The website has standards for several programming languages - along with a python program to verify the style and an emacs script for using the style. -
+ along with a python program to verify the style and an emacs script for using the style.A new indent option "indent-modifiers" will indent class access modifiers (public, protected, or 'private) one-half - indent. The rest of the class is not indented. It is described in the "Indentation Options" section of the documentation. -
+ indent. The rest of the class is not indented. It is described in the "Indentation Options" section of the + documentation.Four new bracket modify options, "attach-namespaces", "attach-classes", "attach-inlines", and "attach-extern-c", can be used to modify your selected bracket style. They are described in a new "Bracket Modify Options" section - of the documentation. -
+ of the documentation.A new option, "remove-brackets", will remove brackets from conditional statements. The statement must be a single - statement on a single line. It is described in the "Formatting Options" section of the documentation. -
+ statement on a single line. It is described in the "Formatting Options" section of the documentation.A new option, "indent-preproc-cond", will indent preprocessor conditional statements (#if #elif, #else, #endif). It is described in the "Indentation Options" section of the documentation. The option "indent-preprocessor" has been deprecated and will be removed in a future release. Use "indent-preproc-define" instead. The processing of - preprocessor #define statements has not changed. -
+ preprocessor #define statements has not changed.A new option, "remove-comment-prefix", will remove a leading '*' from multi-line comments. It is described in the "Formatting Options" section of the documentation. With the syntax coloring of modern editors a leading '*' @@ -183,125 +348,102 @@ The idea is that a style that is hard to maintain will discourage modification and updating. The converted style should retain most of the formatting within the comment and result in a comment that is easier to maintain. For consistency the option also indents multi-line comments that are not preceded by the '*'. This may slightly modify - the indentation of any commented-out code. -
+ the indentation of any commented-out code.The option "pad-first-paren-out" was fixed to not pad if the following paren is empty. This makes the option consistent with "pad-paren-out". To fix empty parens that have been padded run with the option "unpad-paren" in addition - to "pad-first-paren-out". This needs to be done only once. -
+ to "pad-first-paren-out". This needs to be done only once.- Processing of C++11 raw string literals has been added. -
+ Processing of C++11 raw string literals has been added.The compiler definition ASTYLE_NO_VCX (no Visual Studio exports) has been changed to ASTYLE_NO_EXPORTS and can be used with any Windows compiler. The Clang compiler needs this option to avoid errors on dynamic libraries. It removes the "__declspec(dllexport)" - definition from exported functions. Linux compilers do not use this. -
+ definition from exported functions. Linux compilers do not use this.A new shared object (DLL) entry point, AStyleMainUtf16, has been added for processing C# UTF-16 strings. C# does not have built in functions for converting the UTF-16 strings to UTF-8. This entry point will accept UTF-16 strings, format the source code, and return UTF-16 strings. The error handling function and version number still use UTF-8 strings. The C# example program in the "Developer Information" shows the new calling procedure. Changes from the - previous release are marked in the example. -
+ previous release are marked in the example.C# strings are UTF-16 on both Windows and Linux. C# does not use the UTF-32 wchar_t strings on Linux. Qt also uses UTF-16 on both Windows and Linux, but has built in UTF-8 conversion functions. Qt strings can be converted to UTF-8 by Qt, or the new entry point can be used. There may be other "managed code" applications on Linux that - use UTF-16. -
+ use UTF-16.The "Links" page has two new sections for links mentioned in previous versions of Artistic Style. It links to - free software and other information. -
+ free software and other information.The "Developer Information" section has a new example and download for calling Artistic Style from an Objective‑C program. Since it is another "C" language the only thing needed is to link the program with a library build of Artistic Style. The example was developed on Windows and Linux using the GNUstep project. Since the example is a console program the problems with the GNUstep GUI have been avoided. It has not been tested on a Mac, but should be close to working. The "Developer Information" section also has new page for "Objective‑C on Windows and - Linux" which has information on compiling and running the example on those systems. -
+ Linux" which has information on compiling and running the example on those systems.The executable included in the Windows distribution was compiled with Visual Studio 2010 (platform toolset v100). Higher releases contain dependencies on Windows API functions that exist only on Windows Vista, Windows 7, and Windows 8. This means that applications built with a Visual Studio 2012 C++ compiler would fail to load and execute - on Windows XP. -
+ on Windows XP.If you are using Windows Vista or higher, and have a Visual Studio 2012 or higher compiler available, recompiling will probably result in faster execution. If you use a compiler other than Visual Studio, you can probably get better execution by compiling using the C++11 standards. Artistic Style uses a lot of string vectors and the new - move semantics will probably result in faster execution. -
+ move semantics will probably result in faster execution.- Thanks to Evmenov Georgiy, Matthew Woehlke, Jiang, Ruzzz, and beta100100 for their contributions. -
+ Thanks to Evmenov Georgiy, Matthew Woehlke, Jiang, Ruzzz, and beta100100 for their contributions.With a new Artistic Style release some unchanged source files will be formatted because of changes to Artistic - Style. You may want to format your source before making program changes in order to bring it up to date. -
+ Style. You may want to format your source before making program changes in order to bring it up to date.A new option, "max-code-length=#" or "xC#", will limit the length of code on a line. A new option "break‑after‑logical", - or "xL", will modify a line break for conditionals. See the documentation for details. -
+ or "xL", will modify a line break for conditionals. See the documentation for details.A new option, "pad-first-paren-out" or "xd", will pad only the first paren in a series on the outside. See the - documentation for details. -
+ documentation for details.A new option, "indent=force-tab-tab=#" or "xT#", will allow force tab indents with a tab length that is different - than the indent length. See the documentation for details. -
+ than the indent length. See the documentation for details.- The short option for delete-empty-lines has changed from "xd" to "xe". -
+ The short option for delete-empty-lines has changed from "xd" to "xe".The C++11 standard for range-based "for" loops, "enum" with a base type, and rvalue references is now supported. The formatting of rvalue references is determined from the existing "align-pointer" and "align-reference" - options. -
+ options.Closing the ending angle brackets of templates is now allowed by the C++11 standard. A new option, "close-templates" or "xy", will close the whitespace in the angle brackets of template definitions. Be sure your compiler supports - this before making the changes. -
+ this before making the changes.- The C/C++ keyword 'extern "C"' in a preprocessor no longer causes an extra indent. -
+ The C/C++ keyword 'extern "C"' in a preprocessor no longer causes an extra indent.Formatting of C++/CLI managed pointers (the '^' character) has been added to the "align-pointer" - option. -
+ option.The breaking of switch "default" statements has been fixed. The "default" statements - that have been incorrectly broken will be fixed in this release. -
+ that have been incorrectly broken will be fixed in this release.The byte order mark (BOM) has been removed from ASLocalizer.cpp for all platforms. The encoding of the file is UTF-8. Many Windows editors can now recognize UTF-8 encoding without the BOM. Visual Studio has an option that needs to be set. With others. such as CodeBlocks, identification is automatic. On Linux, UTF-8 is the default - encoding. -
+ encoding.Translations have been added for Dutch, Finnish, Italian, Japanese, Korean, Polish, Portuguese, Russian, Swedish, and Ukrainian. The translations were done with an automated translation program, Google Translate, so they may not be the best translation possible. The translations are at the end of ASLocalizer.cpp in the form of an English‑Translation pair. If you correct a translation, send the source as a bug report and it will be included in the next release. To add a language, see "Internationalization" in the "General Information" section of the documentation. Send - the addition as a bug report and it will be included in the next release. -
+ the addition as a bug report and it will be included in the next release.There is a new Linux makefile for the Clang Compiler. Clang is a free compiler can be installed as a package on many Linux distributions. Some of its features are fast compiles, low memory use, expressive diagnostic messages, and GCC compatibility. It includes a static analyzer tool that finds potential bugs in your source code. An experimental - version can be installed on a Windows platform. There is more information in the Install Information documentation. -
+ version can be installed on a Windows platform. There is more information in the Install Information + documentation.Visual Studio automatically creates an import library and an export file when you link a program that contains exports. It will do this for even a static library if it contains a __declspec(dllexport) definition. The Artistic @@ -310,32 +452,28 @@ to eliminate the files from the output. Use this only for static libraries or when the AStyle source is included in the compile. Do NOT use this when compiled as a shared (dynamic) library. It is effective only for Visual Studio 2012. It will NOT work with previous versions. It has no effect with other compilers since they require a separate - option to create the import library and export files. -
+ option to create the import library and export files.The executable included in the Windows distribution was compiled with Visual Studio 2010 (platform toolset v100). Visual Studio 2012 (platform toolset v110) contains dependencies on Windows API functions that exist only on Windows Vista, Windows 7, and Windows 8. This means that applications built with a Visual Studio 2012 C++ compiler would fail to load and execute on Windows XP. Artistic Style was therefore compiled with Visual Studio 2010 to work - on computers using Windows XP. -
+ on computers using Windows XP.If you are using Windows Vista or higher, and have the Visual Studio 2012 compiler available, recompiling with Visual Studio 2012 will probably result in faster execution. The Windows distribution has Visual Studio 2012 project - files available. -
+ files available.If you use a compiler other than Visual Studio, you can probably get better execution by compiling using the C++11 standards. Artistic Style uses a lot of string vectors and the new move semantics will probably result in faster - execution. (To use C++11 on GCC and MinGW use the option --std=c++0x). This may change on future compiler releases.). -
+ execution. (To use C++11 on GCC and MinGW use the option --std=c++0x). This may change on future compiler + releases.The "Developer Information" page has a new example and download for calling Artistic Style from a Python script. It will run with both Python 2 and Python 3. Using Python 3 shows an example of formatting a Unicode string with Artistic Style. Unicode strings must be encoded to UTF-8 before formatting and decoded back to Unicode afterward. The example script shows the technique for doing this. It also shows how to set up the function pointers and allocate - memory in Python. -
+ memory in Python.If you use Visual Studio on Windows, it can now be used for Python development. Python Tools for Visual Studio (PTVS) is a free and open source plug-in for Visual Studio 2010 that supports Python and Iron Python. Other interpreters @@ -343,52 +481,23 @@ best thing is the Visual Studio debugging support using the .NET debugger and the normal Visual Studio debugger. It enables you to set break points, step through functions, change the current statement, inspect local variables, and perform other operations while debugging. It is best to use it with a project file, a minor irritation for - single page scripts. And there are some minor bugs. But overall it works quite well. -
+ single page scripts. And there are some minor bugs. But overall it works quite well.- Thanks to Christopher Sean Morrison, Keith OHara, louis6g, and J for their contributions. -
+ Thanks to Christopher Sean Morrison, Keith OHara, louis6g, and J for their contributions.- -
+- Previous releases are available in the News Archives. -
+ Previous releases are available in the + News Archives.- -
+ -
-
-
- -
- - - - - - - - - - + diff --git a/doc/notes.html b/doc/notes.html index 386f930..3efc52c 100644 --- a/doc/notes.html +++ b/doc/notes.html @@ -1,6 +1,6 @@ - + - +- -
+ + +- -
+Previous releases are available in the Release - Notes Archives. -
+ Notes Archives.- -
+ -
-
-
- -
- - - - - - - - - - + diff --git a/doc/styles.css b/doc/styles.css index 127fd79..892ca1c 100644 --- a/doc/styles.css +++ b/doc/styles.css @@ -7,7 +7,6 @@ * p.contents entries are for the table of contents * a.contents are table of contents links (not underlined) * a.links are links (underlined) - * .footer is the image table at the bottom of the page * img does not have a border * pre is a predefined format for formatting code */ @@ -19,7 +18,7 @@ h1 { color: #0000A0; text-align: center; font-style: italic; margin-top: 18pt; m h2.large { color: #0000A0; text-align: center; font-size: x-large; margin-top: 0.4in; margin-left: -0.5in; } h2 { color: #0000A0; text-align: center; font-size: larger; margin-top: 0.4in; margin-left: -0.5in; } h3 { color: #0000A0; margin-top: 0.4in; margin-left: -0.4in; } -h4 { color: #0000A0; } +h4 { color: #0000A0; margin-top: 0.3in; } p.noindent { margin-left: -0.4in; } p.contents1 { font-size: 105%; margin-top: 0in; margin-left: 0in; margin-bottom: 0in; margin-right: 0in; } @@ -31,9 +30,6 @@ a.contents:hover { color: #F00000; text-decoration: none; } a:link, a:visited { color: #0000A0; text-decoration: underline; } a:hover { color: #F00000; text-decoration: underline; } -center.footer { margin-left: -0.4in; margin-top: 0.25in; } -h2.footer { font-size: x-large; margin-top: 0; margin-left: 0; } - img { border: none; } pre { margin-left: 0.3in; color: navy; font-weight: bold; } diff --git a/makefile/clang/Makefile b/makefile/clang/Makefile index f6704e8..c36114d 100644 --- a/makefile/clang/Makefile +++ b/makefile/clang/Makefile @@ -1,7 +1,6 @@ # Make file for GCC compiler on Linux or compatible OS -# The license.html file describes the conditions under which this software may be distributed. -# list of source files +# list of source files for astyle SRC = astyle_main.cpp \ ASBeautifier.cpp \ ASFormatter.cpp \ @@ -9,6 +8,13 @@ SRC = astyle_main.cpp \ ASLocalizer.cpp \ ASResource.cpp +# list of source files for libraries without ASLocalizer +SRCx = astyle_main.cpp \ + ASBeautifier.cpp \ + ASFormatter.cpp \ + ASEnhancer.cpp \ + ASResource.cpp + # source directories vpath %.cpp ../../src vpath %.h ../../src @@ -24,15 +30,12 @@ ifndef prefix prefix=/usr endif SYSCONF_PATH=$(prefix)/share/doc/astyle -# the path was changed in release 2.01 -# SYSCONF_PATH_OLD may be removed at the appropriate time -SYSCONF_PATH_OLD=$(prefix)/share/astyle # define macros bindir = bin objdir = obj ipath=$(prefix)/bin -CBASEFLAGS = -W -Wall -fno-rtti -fno-exceptions +CBASEFLAGS = -Wall -Wextra -fno-rtti -fno-exceptions JAVAINCS = -I$(JAVA_HOME)/include CXX = clang++ INSTALL=install -o $(USER) -g $(USER) @@ -67,54 +70,54 @@ endif # a suffix is added for each build OBJ = $(patsubst %.cpp,$(objdir)/%.o,$(SRC)) OBJd = $(patsubst %.cpp,$(objdir)/%_d.o,$(SRC)) -OBJs = $(patsubst %.cpp,$(objdir)/%_s.o,$(SRC)) -OBJsd = $(patsubst %.cpp,$(objdir)/%_sd.o,$(SRC)) -OBJa = $(patsubst %.cpp,$(objdir)/%_a.o,$(SRC)) -OBJad = $(patsubst %.cpp,$(objdir)/%_ad.o,$(SRC)) -OBJsj = $(patsubst %.cpp,$(objdir)/%_sj.o,$(SRC)) -OBJsjd = $(patsubst %.cpp,$(objdir)/%_sjd.o,$(SRC)) +OBJs = $(patsubst %.cpp,$(objdir)/%_s.o,$(SRCx)) +OBJsd = $(patsubst %.cpp,$(objdir)/%_sd.o,$(SRCx)) +OBJa = $(patsubst %.cpp,$(objdir)/%_a.o,$(SRCx)) +OBJad = $(patsubst %.cpp,$(objdir)/%_ad.o,$(SRCx)) +OBJsj = $(patsubst %.cpp,$(objdir)/%_sj.o,$(SRCx)) +OBJsjd = $(patsubst %.cpp,$(objdir)/%_sjd.o,$(SRCx)) # define object file rule (with the suffix) for each build # OBJ $(objdir)/%.o: %.cpp astyle.h astyle_main.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSr) -c -o $@ $< + $(CXX) $(CFLAGSr) -c $< -o $@ # OBJd $(objdir)/%_d.o: %.cpp astyle.h astyle_main.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSd) -c -o $@ $< + $(CXX) $(CFLAGSd) -c $< -o $@ # OBJs $(objdir)/%_s.o: %.cpp astyle.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSs) -c -o $@ $< + $(CXX) $(CFLAGSs) -c $< -o $@ # OBJsd $(objdir)/%_sd.o: %.cpp astyle.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSsd) -c -o $@ $< + $(CXX) $(CFLAGSsd) -c $< -o $@ # OBJa $(objdir)/%_a.o: %.cpp astyle.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSa) -c -o $@ $< + $(CXX) $(CFLAGSa) -c $< -o $@ # OBJad $(objdir)/%_ad.o: %.cpp astyle.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSad) -c -o $@ $< + $(CXX) $(CFLAGSad) -c $< -o $@ # OBJsj $(objdir)/%_sj.o: %.cpp astyle.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSsj) -c -o $@ $< + $(CXX) $(CFLAGSsj) -c $< -o $@ # OBJsjd $(objdir)/%_sjd.o: %.cpp astyle.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSsjd) -c -o $@ $< + $(CXX) $(CFLAGSsjd) -c $< -o $@ ################################################## # define build dependencies for each command @@ -131,16 +134,16 @@ astyled: $(OBJd) $(CXX) $(LDFLAGSd) -o $(bindir)/$@ $^ @ echo -shared: libastyle-2.05.1.so -libastyle-2.05.1.so: $(OBJs) +shared: libastyle.so +libastyle.so: $(OBJs) @ mkdir -p $(bindir) - $(CXX) -shared $(LDFLAGSr) -o $(bindir)/$@ $^ + $(CXX) -shared $(LDFLAGSr) -o $(bindir)/libastyle-2.06.so $^ @ echo -shareddebug: libastyle-2.05.1d.so -libastyle-2.05.1d.so: $(OBJsd) +shareddebug: libastyled.so +libastyled.so: $(OBJsd) @ mkdir -p $(bindir) - $(CXX) -shared $(LDFLAGSd) -o $(bindir)/$@ $^ + $(CXX) -shared $(LDFLAGSd) -o $(bindir)/libastyle-2.06d.so $^ @ echo static: libastyle.a @@ -155,16 +158,16 @@ libastyled.a: $(OBJad) ar crs $(bindir)/$@ $^ @ echo -java: libastyle-2.05.1j.so -libastyle-2.05.1j.so: $(OBJsj) +java: libastylej.so +libastylej.so: $(OBJsj) @ mkdir -p $(bindir) - $(CXX) -shared $(LDFLAGSr) -o $(bindir)/$@ $^ + $(CXX) -shared $(LDFLAGSr) -o $(bindir)/libastyle-2.06j.so $^ @ echo -javadebug: libastyle-2.05.1jd.so -libastyle-2.05.1jd.so: $(OBJsjd) +javadebug: libastylejd.so +libastylejd.so: $(OBJsjd) @ mkdir -p $(bindir) - $(CXX) -shared $(LDFLAGSd) -o $(bindir)/$@ $^ + $(CXX) -shared $(LDFLAGSd) -o $(bindir)/libastyle-2.06jd.so $^ @ echo all: release debug shared shareddebug static staticdebug @@ -181,19 +184,17 @@ install: $(INSTALL) -m 755 -d $(ipath) @$(INSTALL) -m 755 $(bindir)/astyle $(ipath) + @if [ -d $(SYSCONF_PATH)/html ]; then \ + rm -rf $(SYSCONF_PATH)/html; \ + fi + $(INSTALL) -m 755 -d $(SYSCONF_PATH) @mkdir -p $(SYSCONF_PATH)/html; @for files in ../../doc/*.html ../../doc/*.css; \ do \ $(INSTALL) -m 644 $$files $(SYSCONF_PATH)/html; \ done - @if [ -d $(SYSCONF_PATH_OLD) ]; then \ - rm -rf $(SYSCONF_PATH_OLD); \ - fi uninstall: rm -f $(ipath)/astyle rm -rf $(SYSCONF_PATH) - @if [ -d $(SYSCONF_PATH_OLD) ]; then \ - rm -rf $(SYSCONF_PATH_OLD); \ - fi diff --git a/makefile/gcc/Makefile b/makefile/gcc/Makefile index b1af4c1..59c7457 100644 --- a/makefile/gcc/Makefile +++ b/makefile/gcc/Makefile @@ -1,7 +1,6 @@ # Make file for GCC compiler on Linux or compatible OS -# The license.html file describes the conditions under which this software may be distributed. -# list of source files +# list of source files for astyle SRC = astyle_main.cpp \ ASBeautifier.cpp \ ASFormatter.cpp \ @@ -9,6 +8,13 @@ SRC = astyle_main.cpp \ ASLocalizer.cpp \ ASResource.cpp +# list of source files for libraries without ASLocalizer +SRCx = astyle_main.cpp \ + ASBeautifier.cpp \ + ASFormatter.cpp \ + ASEnhancer.cpp \ + ASResource.cpp + # source directories vpath %.cpp ../../src vpath %.h ../../src @@ -24,15 +30,12 @@ ifndef prefix prefix=/usr endif SYSCONF_PATH=$(prefix)/share/doc/astyle -# the path was changed in release 2.01 -# SYSCONF_PATH_OLD may be removed at the appropriate time -SYSCONF_PATH_OLD=$(prefix)/share/astyle # define macros bindir = bin objdir = obj ipath=$(prefix)/bin -CBASEFLAGS = -W -Wall -fno-rtti -fno-exceptions +CBASEFLAGS = -Wall -Wextra -fno-rtti -fno-exceptions JAVAINCS = -I$(JAVA_HOME)/include CXX = g++ INSTALL=install -o $(USER) -g $(USER) @@ -67,54 +70,54 @@ endif # a suffix is added for each build OBJ = $(patsubst %.cpp,$(objdir)/%.o,$(SRC)) OBJd = $(patsubst %.cpp,$(objdir)/%_d.o,$(SRC)) -OBJs = $(patsubst %.cpp,$(objdir)/%_s.o,$(SRC)) -OBJsd = $(patsubst %.cpp,$(objdir)/%_sd.o,$(SRC)) -OBJa = $(patsubst %.cpp,$(objdir)/%_a.o,$(SRC)) -OBJad = $(patsubst %.cpp,$(objdir)/%_ad.o,$(SRC)) -OBJsj = $(patsubst %.cpp,$(objdir)/%_sj.o,$(SRC)) -OBJsjd = $(patsubst %.cpp,$(objdir)/%_sjd.o,$(SRC)) +OBJs = $(patsubst %.cpp,$(objdir)/%_s.o,$(SRCx)) +OBJsd = $(patsubst %.cpp,$(objdir)/%_sd.o,$(SRCx)) +OBJa = $(patsubst %.cpp,$(objdir)/%_a.o,$(SRCx)) +OBJad = $(patsubst %.cpp,$(objdir)/%_ad.o,$(SRCx)) +OBJsj = $(patsubst %.cpp,$(objdir)/%_sj.o,$(SRCx)) +OBJsjd = $(patsubst %.cpp,$(objdir)/%_sjd.o,$(SRCx)) # define object file rule (with the suffix) for each build # OBJ $(objdir)/%.o: %.cpp astyle.h astyle_main.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSr) -c -o $@ $< + $(CXX) $(CFLAGSr) -c $< -o $@ # OBJd $(objdir)/%_d.o: %.cpp astyle.h astyle_main.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSd) -c -o $@ $< + $(CXX) $(CFLAGSd) -c $< -o $@ # OBJs $(objdir)/%_s.o: %.cpp astyle.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSs) -c -o $@ $< + $(CXX) $(CFLAGSs) -c $< -o $@ # OBJsd $(objdir)/%_sd.o: %.cpp astyle.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSsd) -c -o $@ $< + $(CXX) $(CFLAGSsd) -c $< -o $@ # OBJa $(objdir)/%_a.o: %.cpp astyle.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSa) -c -o $@ $< + $(CXX) $(CFLAGSa) -c $< -o $@ # OBJad $(objdir)/%_ad.o: %.cpp astyle.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSad) -c -o $@ $< + $(CXX) $(CFLAGSad) -c $< -o $@ # OBJsj $(objdir)/%_sj.o: %.cpp astyle.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSsj) -c -o $@ $< + $(CXX) $(CFLAGSsj) -c $< -o $@ # OBJsjd $(objdir)/%_sjd.o: %.cpp astyle.h @ mkdir -p $(objdir) - $(CXX) $(CFLAGSsjd) -c -o $@ $< + $(CXX) $(CFLAGSsjd) -c $< -o $@ ################################################## # define build dependencies for each command @@ -131,16 +134,16 @@ astyled: $(OBJd) $(CXX) $(LDFLAGSd) -o $(bindir)/$@ $^ @ echo -shared: libastyle-2.05.1.so -libastyle-2.05.1.so: $(OBJs) +shared: libastyle.so +libastyle.so: $(OBJs) @ mkdir -p $(bindir) - $(CXX) -shared $(LDFLAGSr) -o $(bindir)/$@ $^ + $(CXX) -shared $(LDFLAGSr) -o $(bindir)/libastyle-2.06.so $^ @ echo -shareddebug: libastyle-2.05.1d.so -libastyle-2.05.1d.so: $(OBJsd) +shareddebug: libastyled.so +libastyled.so: $(OBJsd) @ mkdir -p $(bindir) - $(CXX) -shared $(LDFLAGSd) -o $(bindir)/$@ $^ + $(CXX) -shared $(LDFLAGSd) -o $(bindir)/libastyle-2.06d.so $^ @ echo static: libastyle.a @@ -155,16 +158,16 @@ libastyled.a: $(OBJad) ar crs $(bindir)/$@ $^ @ echo -java: libastyle-2.05.1j.so -libastyle-2.05.1j.so: $(OBJsj) +java: libastylej.so +libastylej.so: $(OBJsj) @ mkdir -p $(bindir) - $(CXX) -shared $(LDFLAGSr) -o $(bindir)/$@ $^ + $(CXX) -shared $(LDFLAGSr) -o $(bindir)/libastyle-2.06j.so $^ @ echo -javadebug: libastyle-2.05.1jd.so -libastyle-2.05.1jd.so: $(OBJsjd) +javadebug: libastylejd.so +libastylejd.so: $(OBJsjd) @ mkdir -p $(bindir) - $(CXX) -shared $(LDFLAGSd) -o $(bindir)/$@ $^ + $(CXX) -shared $(LDFLAGSd) -o $(bindir)/libastyle-2.06jd.so $^ @ echo all: release debug shared shareddebug static staticdebug @@ -181,19 +184,17 @@ install: $(INSTALL) -m 755 -d $(ipath) @$(INSTALL) -m 755 $(bindir)/astyle $(ipath) + @if [ -d $(SYSCONF_PATH)/html ]; then \ + rm -rf $(SYSCONF_PATH)/html; \ + fi + $(INSTALL) -m 755 -d $(SYSCONF_PATH) @mkdir -p $(SYSCONF_PATH)/html; @for files in ../../doc/*.html ../../doc/*.css; \ do \ $(INSTALL) -m 644 $$files $(SYSCONF_PATH)/html; \ done - @if [ -d $(SYSCONF_PATH_OLD) ]; then \ - rm -rf $(SYSCONF_PATH_OLD); \ - fi uninstall: rm -f $(ipath)/astyle rm -rf $(SYSCONF_PATH) - @if [ -d $(SYSCONF_PATH_OLD) ]; then \ - rm -rf $(SYSCONF_PATH_OLD); \ - fi diff --git a/src/ASBeautifier.cpp b/src/ASBeautifier.cpp index 086b037..61bf441 100644 --- a/src/ASBeautifier.cpp +++ b/src/ASBeautifier.cpp @@ -1,39 +1,29 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * ASBeautifier.cpp - * - * Copyright (C) 2014 by Jim Pattee - *