Artistic Style - News Archives

# Artistic Style News Archives

### Artistic Style 2.02 (May 2011)

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.

#### Release 2.02.1 - November 2011

This bug fix release is issued because of the length of time required for the some of the changes in the next release (2.03). Bugs with the breaking of "case" statements and a crash with pointer to pointer (**) in align-pointer=type have been fixed. The "case" statements that have been incorrectly broken will be fixed in this release. Pointers and references are now processed for C# files. See the "Release Notes" for more information and additional changes.

#### The following information is for the original 2.02 release.

#### Translations

A new program module and header, ASLocalizer.cpp and ASLocalizer.h, have been added. These are required for the console build and are optional for the library builds. It contains language translations for several of the most common users of Artistic Style. The method used was adapted from the Gnu "gettext" method.

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.

A new option, "ascii" or "I", will display the text in English regardless of your system settings. This option must be input from the command line and not an option file. See the documentation for details.

The translations were mostly 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, add a new translation class to ASLocalizer.h. Add the English‑Translation pair to the constructor in ASLocalizer.cpp. Update the WinLangCode array, if necessary, 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.

#### Brackets

Since release 1.22 (April 2008) the predefined styles have increased from 5 to 12 and the bracket types have increased from 4 to 6. Having two different ways of defining bracket styles has resulted in some confusion and unnecessary duplication. This release starts a redesign of the bracket definitions to simplify the user interface. The predefined styles and bracket types will be combined into a single option category.

The "Predefined Style" options have been renamed "Bracket Style" options. The "Bracket Options" have been depreciated and will be removed in a future release. If you are using a "brackets=" option, you should start changing to one of the "style=" options. There is a "style" option available for every "brackets" option.

All "Bracket Style" options now default to 4 spaces per indent. If you were using a "Predefined Style" with a default indent other than 4, you will need to add one of the "Tab Options" to maintain the same indentation. The styles which used indents other than 4 were:

- Stroustrup - 5 spaces per indent.
- Gnu - 2 spaces per indent.
- Linux - 8 spaces per indent.
- Horstmann - 3 spaces per indent.

There is a new "Bracket Style" option "style=pico" or "A11". It uses run-in brackets, like Horstmann style, and attaches the closing bracket to the last line in the block. It sets the options "keep one line blocks" and "keep one line statements". This is a very compact style and is a good style for small monitors.

Another new "Bracket Style" option is "style=lisp" or "style=python" or "A12". It uses attached brackets, like Java style, and attaches the closing bracket to the last line in the block. It sets the option "keep one line statements". This style makes indentation the only way of distinguishing blocks of code, but has the advantage of containing no uninformative lines. Like Pico, it is also a very compact style.

The option "brackets=horstmann" has been removed. Instead use "style=horstmann" or "A9". The short option "g" is now equivalent to the new "brackets=run-in". Run-in brackets are used for both Horstmann and Pico styles.

The option "indent-brackets" and short option "B" have been removed. Instead use "style=whitesmith" or "style=banner".

The option "indent-blocks" and short option "G" have been removed. Instead use "style=gnu".

Two new options, "style=break" and "style=attach", have been added for Allman and Java bracket styles respectively.

#### Other Changes

To allow for future expansion the short options will now allow an "x" prefix to be used. New short options may start with an "x" and will be followed by another character (e.g. "xa", "xb", "xc" ...). The current options, with one exception, will still be valid.

The short option for "delete-empty-lines" has been changed from "x" to "xd" to allow for the expansion of short options.

A new option "align-reference=" (-W#) allows references to be aligned separate from pointers. See the documentation for details.

Since computer screens are getting wider the maximum value for "max-instatement-indent" has been increased from 80 to 120.

New options ignore‑exclude‑errors (‑i) and ignore‑exclude‑errors‑x (‑xi) will allow processing to continue if there are errors in the "exclude" options. This lets the excludes for several projects to be entered in a single option file. The "ignore" options may be placed in the same option file as the excludes. The ignore‑exclude‑errors option will display the unmatched excludes, ignore‑exclude‑errors‑x will not display them.

Artistic Style can now format UTF-16 encoded files, both little and big endian. This encoding is the default for Visual Studio Unicode files. The file is formatted by converting it to UTF‑8 and then back to UTF‑16. The conversion process does not add a significant amount of time to the formatting. The UTF-16 file must be encoded with a byte-order-mark (BOM) to be recognized. Again, this is the Visual Studio default.

The Visual Studio project files now have a solution for both Win32 and x64 compiles. The x64 version will be needed if you are using an Artistic Style DLL for Java or C# on a Windows 7 platform. Or you may just prefer an x64 console program. The executable included in the Windows distribution is still Win32. It will work on both Win32 and x64 systems.

If you use Visual Studio C++ Express the 2010 release has the ability to compile x64 code. But you must use Vista or Windows 7 and need to install the .NET Framework SDK. I have created a brief instruction page here. Note that a fix is required if you apply Service Pack 1 after installing the .NET Framework SDK.

The documentation contains a new section "Command-line Only" which lists commands that are not available from an options file. The options were transferred from the "Other Options" section.

Thanks to Milian Wolff, Johannes Martin, and Arne F?rlie, and Marvin Humphrey for their contributions. The UTF‑8 and UTF‑16 conversions were obtained from the SciTE source code editor.

#### Survey Results

The results of the survey posted last release are available at General Information and Artistic Style Options. Thanks to everyone who took the time to complete it.

Surveys give an indication of how many people are using an option or want certain features. This is information that is not available in the bug reports.

In the "Enhancements" group there were three items with multiple requests. The most frequent request by far was to enforce a maximum line length. This is also the oldest request in the bug reports. Another item with multiple requests was to disable/enable Artistic Style formatting on request within source files. This is the second oldest request in the bug reports. A third item with multiple requests was to customize namespace brackets independent of the requested bracket style. I will try to address these in the next release.

Things that stand out to me in the multiple‑choice sections:

- The predefined styles and brackets options were each used about 50% each. That will change with this release.
- Over 50% of the survey uses Artistic Style for Windows. I have been working for a couple of years on a new program based on wxWidgets. I will try to give this more priority in the future.
- Over 75% of the survey uses Artistic Style to format entire projects.
- About one‑third of the Windows C++ users use Artistic Style for Managed C++.
- The most popular option is add‑brackets (60%), which was just recently added.
- The attach‑pointer options, in total (70%), are even more popular than add-brackets. They were also recently added.
- The preserve-date option is used by nearly one-third of the survey.
- All of the options are used by someone in the survey, even the ones I thought were outdated. The bracket styles that are not used are probably a result of not having enough response.

#### Developers

The Artistic Style for Windows program contains a sample GUI using the new bracket style options. The old predefined styles are now the bracket styles. The bracket options have been removed along with the indent‑brackets and indent‑blocks options. The new bracket styles all use the same default indent of 4 spaces, therefore it is not necessary to set an indentation from the bracket style. The new format is available for use with this release.

### Artistic Style 2.01 (November 2010)

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.

A new feature at SourceForge is download maps that show a list of downloads by country. It is available from the top menu at Develop > Download Stats (Beta), and clicking on the "top country" area. The list of downloads shows about 75% of Artistic Style downloads are from non English speaking countries. This release is the start of the internationalization of Artistic Style.

Artistic Style now sets the native local so that characters from the user’s native language will be recognized in directory names and file names. Artistic Style for Windows has also been changed to use the native locale. For Linux systems using UTF-8 locales, characters from any language will be recognized and any combination of languages can be used. For Windows, only languages recognized by the native codepage can be used. For example, the English locale (codepage 1252) also has French, German, Italian, Portuguese, Spanish, plus several other languages. Other locals, such as Chinese and Japanese, only support one language. Unicode was not used due to the varying degree of support by different compilers for console applications.

The locale setting also affects the way numbers are displayed. Language translations may be provided in a future release.

This is a major release (2.01) because of the internationalization and changes that will occur in the next couple of releases. Future releases will contain a major change to the bracket options and a rewrite of the file access method. Some of the requested changes require looking at blocks of code instead of single lines. The current program has been patched to do this but a rewrite of the file input is needed. These are both major changes but with the new test framework in place they should be manageable.

There has been a change to the ‑‑min‑conditional‑indent option. Instead of using the number of spaces it now uses a code expressed in number of indents. This will allow the option to be set independently of the spaces per indent. If you are using the default setting of two indents, or a setting of zero indents, there is no change necessary to the input. Otherwise, check the documentation for the new codes.

The --style=linux has been changed to ALWAYS use a minimum conditional indent of one-half the indent length. This is in the style definition and cannot be changed. If you do not want this setting use the K&R style instead.

The MFC macros BEGIN_DISPATCH_MAP, BEGIN_EVENT_MAP, and BEGIN_PROPPAGEIDS are now formatted.

Checksum verification has been added to source file output that will help assure that no code has been duplicated or omitted. This is effective only in the debug configuration used for testing.

The test framework has been changed from UnitTest++ to Google Test, which is actively maintained, has a mock object framework (Google Mock), and good documentation. Regression and system testing have been automated with Python scripts. Python has also been used for class verification checks and other repetitive procedures.

If you use Visual Studio C++ Express the 2010 release has the ability to create x64 code. But you must use Vista or Windows 7 and need to install the .NET Framework SDK. I have created a brief instruction page here.

Thanks to Matthew Woehlke, Chris Schwarz, Chang Jiang, and Arseny Solokha for their contributions.

#### Developers

On the library build of Artistic Style, the second argument of the fpError typedef and the javaErrorHandler declaration has been changed from "char*" to "const char*". This could cause a compile error if not changed in the source statements.

There has been a change in the ‑‑min‑conditional‑indent option. Instead of using number of spaces to indent it now uses a code expressed in number of indents. In the past this option was a problem because it was also affected by changes in indent length. With this release there is only one variable affected. The option is not affected by changes in indent length. The minimum conditional indent length is computed automatically by ASFormatter after all the options have been processed. Refer to the code in astyle_main.cpp to see how the option is processed.

The --style=linux has been changed to ALWAYS use a minimum conditional indent of one-half the indent length. The option is set in the function fixOptionVariableConflicts.

The use of locales affects only the command line build.

### Artistic Style 1.24 (February 2010)

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.

A new bracket type option, ‑‑brackets=horstmann (-g), uses broken brackets and places run-in statements on the same line as an opening bracket. This bracket type has about the same vertical compression as attached brackets and in addition provides bracket alignment. It is the only style that combines the advantages of saving space and aligning brackets. The "Tab and Bracket Options" section in the documentation contains the details. To accommodate Hostmann brackets the "none mode" brackets will now allow run-in statements. Array formatting has been changed to format run-in statements when required. There have been some general improvements to array formatting. The minimum value for spaces per tab was changed from one to two. The example programs in the "Developer Information" section have been changed to Horstmann brackets.

Two new options, ‑‑add‑brackets (-j) and ‑‑add‑one‑line‑brackets (-J), will add brackets to unbracketed one line conditional statements. The ‑‑add-brackets will add the brackets according to the currently requested predefined style or bracket type. If no style or bracket type is requested the brackets will be the attached type. The ‑‑add‑one‑line‑brackets will add the brackets as single line brackets. This option implies ‑‑keep‑one‑line‑blocks and will not break single line blocks.

The above options allow two new predefined styles. Horstmann style, ‑‑style=horstmann (-A9), uses Horstmann brackets and three spaces per indent. The so called "One True Brace Style", ‑‑style=1tbs or ‑‑style=otbs (-A10), uses linux brackets and the option ‑‑add‑brackets. The basic criteria for most predefined styles were obtained from the Indent Style discussion at Wikipedia. The "Predefined Style Options" section in the documentation contains the details.

The spaces per indent can now be changed for any of the predefined styles. In previous releases the option would be ignored. This will allow any of the ‑‑indent options to be used with a predefined style. If the spaces per indent is not specified, the default for the style will be used.

A new option, ‑‑pad‑header (‑H), will insert space padding after headers ('if', 'for', 'while'...). To remove any unwanted current space padding, use the option ‑‑unpad‑paren (‑U). If both ‑‑pad‑header and ‑‑unpad‑paren are used, the headers will be padded and the padding will be removed from other parens. This has required a change to the default formatting of paren headers. They will now be left unchanged instead of automatically inserting space padding, unless the new option is requested.

New options --align-pointer=type (-k1), ‑‑align‑pointer=middle (-k2), and ‑‑align‑pointer=name (-k3) will attach a pointer or reference operator (* or &) to either the operator type (left), operator name (right), or align it between the type and name. The spacing between the type and name will be preserved, if possible. The recognition of pointers and references has been improved. This resulted in an improvement of the ‑‑pad‑oper (-p) option.

A new option, ‑‑indent‑col1‑comments (-Y), will 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.

New options --lineend=windows (-z1), --lineend=linux (-z2), and --lineend=macold (-z3) will force use of the specified line end style. Valid options are windows (CRLF), linux (LF), and macold (CR). MacOld style is the format for OS 9 and earlier. Mac OS X uses the Linux style. Changes in line ends will cause the file to be updated, even if no other changes occur. If one of these options is not used the line ends will be determined automatically from the input file.

Default line end processing has been improved to always output consistent line ends. It will use the line ends that are most frequently used in the input.

The Stroustrup predefined style has been changed to use 5 spaces per indent. This is the indentation used in the book "The C++ Programming Language" by Bjarne Stroustrup.

The minimum conditional indent for the Linux predefined style has been changed to 4, or one-half the indent-length. The previous minimum conditional indent was 16 (2 indents). The new value corresponds to the soft tab in the style description at Wikipedia and gives a better conformance to the definition of the style. And it gives a better appearance to the continuation lines.

Embedded SQL statements are now formatted correctly. The formatting of the SQL statements 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.

Assembler statement processing has been improved to include extended assembly and Microsoft specific assembler lines and blocks.

The --indent-classes (-C) option has been fixed to indent C++ struct blocks containing access modifiers (public, protected, and private). The struct block is not indented if there are no access modifiers in the block.

The formatting for C++ class initializer statements has been changed from two indents to one and an in-statement indent added for continuation lines.

The intermediate .tmp file used in formatting has been eliminated and memory is used instead. In most cases this should result in a noticeable speed improvement.

Checks for the maximum in-statement indent have been fixed. The indent for some long continuation lines may be decreased. If you want the previous indentation, increase the ‑‑max‑in‑statement option.

Occasionally, someone will use Artistic Style to format a file encoded with UTF-16 or UTF-32 bit encoding. These files contain many nul bytes are incompatible with the 8 bit encoding assumed by Artistic Style. Since this rarely happens, Artistic Style has been changed to list these files as "unformatted" and display a warning message. The files must have a Byte Order Mark (BOM) for the encoding to be recognized. These files can be changed with the program iconv and with some text editors such as SciTE. For more information see the Wikipedia discussion on "Comparison of Unicode encodings", "Compatibility issues".

The Artistic Style documentation has been changed to include a new "Padding Options" section. The padding options were previously in the "Formatting Options" section. This was done to allow space for additional options in GUIs.

The Scripts page has a couple of new scripts, including a "clean" script in python.

There are new configuration and project files for Visual Studio, and additional files for Visual Studio 2010. There are instructions in the "Install Information".

The Intel compiler for Linux, release 11.1, has a new procedure for compiles. Read the new "Install Information" before using this compiler release.

There is now a Subversion repository for Artistic Style. A new Subversion web page describes how to check-out the files. The source code is under development and some changes take several weeks to complete. And the intermediate source files have not been through the extensive system tests that are done before each release. Use reasonable precautions when using source code from the repository.

SourceForge recently made changes to their website which caused a few problems. The web page links should be fixed with this release. It seems that some bug reports may have been lost. If you have submitted a report that has not been addressed please check to be sure it is still there. In addition Yahoo closed their GeoCities site which made the AStyleWin programs temporarily unavailable. The new site is jimp03.zxq.net/.

The release announcements mailing list was discontinued with the new SourceForge system. There is a new astyle-announce mailing list that will be used instead. This is a low volume list that will be used for new release announcements and notification of important repository commits. Member postings will not be accepted. Membership in the old list was not retained so you will need to register for the new list. There is information for subscribing on the "Bug Reports, Change Requests, Notification" section of the Home page.

Thanks to J P Nurmi (align-pointer), Mario Gleichmann (pad-header), MrTact (lineend), Christian Stimming (<< and >> operators), Wim Rosseel (Perl script), Colin D Bennett (64-bit code), and Ettl Martin (cppcheck) for their contributions.

The OpenVMS distribution is prepared by Jim Duff, an OpenVMS Systems Specialist living in Sydney, Australia. His website is eight‑cubed.com.

#### Developers

The Artistic Style for Windows program has been updated to support the current release and can be used for an example GUI. It will run on Linux under WINE. It is available at jimp03.zxq.net

The options --lineend=windows (-z1), --lineend=linux (-z2), and --lineend=macold (-z3) apply only to the console build. It was not included in the developer builds because developers usually have their own method for handling line ends.

The option --break-closing-brackets has been moved from Bracket Options to Formatting Options. It was being mistaken for a bracket type, which it is not.

Rejecting a file for UTF-16 or UTF-32 bit encoding apply only to the console build. Some class libraries, such as wxWidgets (and probably Qt), have the methods to convert the files to UTF-8. The handling for these types of files must be determined by the individual applications.

There has been an additional variable, formattingStyle, added to the ASFormatter class. This is now the ONLY option that needs to be set to define the style. Setting the individual options is no longer necessary. The individual options are now set in the fixOptionVariableConflicts function in ASFormatter. The predefined style options will now override all other options. The order of entry does not matter as in previous versions.

### Artistic Style 1.23 (February 2009)

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.

In the last few years the names of indent styles have been somewhat standardized. A typical example is the Indent Style discussion at Wikipedia. To keep up to date with the industry, changes have been made to the names of two of the styles. The ANSI style can now also be Allman or BSD, and for the KR or Java style you should now use only Java. The KR style has always been basically the same as the Java style. The KR style is depreciated and will be removed sometime in the future.

Four new predefined styles have been added, K&R (with an &), Stroustrup, Whitesmith, and Banner. K&R style uses Linux type brackets where the depreciated KR style uses attached brackets. Notice that K&R and KR are two different styles. Stroustrup style uses the new stroustrup brackets described below. Whitesmith has broken brackets that are indented. Banner has attached brackets that are indented. The following table summarizes the changes:

old style |  | new style
--- | --- | ---
ansi |  | allman or ansi or bsd
java or kr |  | java
gnu |  | gnu
linux |  | linux
none |  | k&r or k/r
none |  | stroustrup
none |  | whitesmith
none |  | banner

There is a new Stroustrup style and bracket type. It is similar to the Linux bracket type except that the brackets are attached to namespaces and classes instead of being broken. It is the style used by Bjarne Stroustrup, the founding father of C++, in his book "The C++ Programming Language".

Indenting brackets in the Whitesmith and Banner styles causes a 'hanging indent' with switch statements and C++ class modifiers (public, private, protected). Microsoft Visual Studio avoids this by giving class and switch blocks an extra indent when brackets are broken (Whitesmith style). Gnu Emacs gives switch blocks an extra indent but not class blocks. With indented, attached brackets (Banner style), Visual Studio does not use an extra indent and Emacs does not have the style. Artistic Style uses an extra indent for switch blocks and C++ class blocks for both Whitesmith and Banner styles. This provides the best appearance in defining the style. If a different format is wanted, use the individual options instead of the predefined style. You can try indent‑brackets, indent‑classes, and indent‑swiches on a class or switch block to see the results.

The GNU style and indent‑blocks option have been changed to indent only the blocks within a function body. The opening bracket for namespaces and classes is no longer indented. The opening bracket for functions remains not indented. This is the same formatting used by the Emacs editor and is in compliance with the GNU standard. The GNU style has also been changed to NOT indent namespaces by default. Namespaces can be indented by using the indent‑namespaces option. This is consistent with the other predefined style options.

The predefined style options will now override all other options. It does not depend on order of entry as in previous versions. Using a predefined style will give that style regardless of other conflicting entries. The predefined styles options now define only the bracket placement and sometimes the spaces per tab. This will give users the option to define the other details according to their preference. The 'Predefined Style Options' section in the documentation contains the details.

Changes have been made to some of the long options. Most configuration files will NOT allow options to have duplicate keys (e.g. the Windows registry and wxWidgets). The key is the value before the first '=' sign. If there is no '=' sign then the entire option is the key. The options were changed to eliminate duplicate keys when more than one option is allowed. The old options are depreciated but will still be valid until at least the next release. The short options remain the same. The following options have changed:

old option |  | new option
--- | --- | ---
force-indent=tab=# |  | indent=force-tab=#
brackets=break-closing |  | break-closing-brackets
pad=oper |  | pad-oper
pad=paren |  | pad-paren
pad=paren-out |  | pad-paren-out
pad=paren-in |  | pad-paren-in
unpad=paren |  | unpad-paren
one-line=keep-statements |  | keep-one-line-statements
one-line=keep-blocks |  | keep-one-line-blocks

The "else if" statements will now be placed on a single line by default. This is described as a 'fix' since it was apparently always supposed to do this. The headers will be broken only if the option 'break‑elseifs' is specified. Most users want the statements joined since breaking them requires an extra indent.

The convert‑tabs option has been changed to maintain the correct spacing according to the current tab setting. Previously a tab was replaced by a single space. The current option for spaces per tab is used. It may NOT produce the expected results if convert‑tabs is used when changing the spaces per tab. The tabs are NOT replaced in quotes.

The break‑blocks and break‑blocks=all options have finally been fixed. They will no longer break statements following the block and will keep preceding comments with the block. Many other fixes were required for the options to work correctly. The "Release Notes" page has the details.

A new delete‑empty‑lines option will delete empty lines within a function or method. If used with break‑blocks or break‑blocks=all it will delete all lines EXCEPT the lines added by the break‑blocks options.

There is a new 'formatted' (‑Q) option that displays only the files that have been formatted. Files that are unchanged are not displayed.

Short options have been added for the predefined styles.

Semi‑colons are now always space padded. All commas are space padded if pad‑oper is used.

The C/C++ keyword 'extern' no longer causes an extra indent.

There have been several important fixes to the indent‑brackets and indent‑blocks options.

There have been several important fixes to C# formatting.

The scripts page has a new Emacs script containing hooks that will set the Emacs style options to the default options used by Artistic Style. It also defines a Banner style. It can be used to compare output from the two programs. The files will not be exact but it should be reasonably close. If you can improve the Emacs script I would like to have the changes.

There are two new projects on the Links page. CodeLite is a C++ development environment with some useful features, including a template to generate a test program using the excellent tool UnitTest++. target="astyle" title="open new window">Highlight converts source code to formatted text with syntax highlighting. It was used it for the source code in the Developer Information section.

I need a Mac OS X user to do testing on new releases. The test usually take 30 minutes at the most. They may need to be repeated two or three times depending on the results. Programming knowledge is not necessary but will probably be helpful. Reply to the project email address if you would like to volunteer.

The OpenVMS distribution is prepared by Jim Duff, an OpenVMS Systems Specialist living in Sydney, Australia. His website is eight‑cubed.com.

Thanks to Eran Ifrah and Max Horn for their contributions. Travis Robinson wrote the original C# interface program.

#### Developers

There is a new page in the Developer Information that has an example of calling Artistic Style from a C# program.

There was an omission in the peekNextLine function added in the last release which causes it to bypass empty lines. If you copied the function into a program, the change is at the end of peekNextLine in astyle_main. The line containing the change is marked with comments. Not correcting it may cause an infrequent line break if the option break‑blocks or break‑blocks=all is used. The break will occur only if there are empty lines within comment lines that precede a header.

There has been an additional variable, formattingStyle, added to the ASFormatter class. This is now the ONLY option that needs to be set to define the style. Setting the individual options is no longer necessary. The individual options are now set in the fixOptionVariableConflicts function in ASFormatter.

The predefined style options will now override all other options. The order of entry does not matter as in previous versions. This will be done even if astyle_main is not used by your system. This was done by moving the checks from astyle_main to ASFormatter. The procedure is in the function fixOptionVariableConflicts in ASFormatter.

The predefined style options now define only the bracket placement and sometimes the spaces per tab. This will give users the option to define the other details according to their preference. It is best if the other options are NOT disabled when a predefined style is selected. All options should be left available to modify the style. The conflicts will be resolved by the fixOptionVariableConflicts function which is called after all options have been processed. All you need to do is set the options selected by the user.

The Artistic Style for Windows program has been updated to support the current release. It is available at jimp03.zxq.net

I apologize for the unplanned changes this may add to your system. But Artistic Style is starting to mature as an application and the changes are needed to bring it up to date. If you have any questions or problems, email me and I will do my best to help you resolve them.

### Artistic Style 1.22 (April 2008)

This release contains many bug fixes. The emphasis was on formatting fixes for C# files. In the last two releases there have been over 80 items removed from the bug report. There have been many more fixes which were not reported but were discovered while testing. The new options in this release exposed many unreported formatting problems. I will try to fix the ones remaining in the next two or three releases. Some of them will be difficult to fix. See the Release Notes for a complete list of changes.

Starting with this release, if a file is not changed by Artistic Style a new file and a backup file are not created. A "make" will not recompile the unchanged file and it will not be committed to a revision control system. A console message will indicate that the file is unchanged. Note that this is different from using the ‑‑preserve‑date option. This option retains the date on files that have changed. In this case the changed files will still be recompiled and committed to revision control. (‑‑preserve‑date actually changes the time by one unit).

In the rare case when Artistic Style aborts, the file being formatted will no longer be deleted. This is done by using a temporary output file (.tmp). It should now be safe to manually abort Artistic Style and restart at any time. The backup of files that were previously formatted will not be replaced.

The console display has been changed. The default now displays one line per file. This will be useful if only one file is being formatted, such as when Artistic Style is called from a text editor or development environment. A new ‑‑verbose (‑v) option will display optional information, such as release number and statistical data. A new ‑‑quiet (-q) option will suppress all output except error messages. Some short options have changed to accommodate the new options. The short option for ‑‑version is now -V (old -v) and for ‑‑convert‑tabs is ‑c (old ‑V).

A new ‑‑recursive (-r, or -R) option will process subdirectories recursively. The filename should contain a wildcard (e.g. "$HOME/astyle/src/*.cpp"). Linux users should place the filename in double quotes so the shell will not resolve the wildcards. Windows users should not include wildcard object files, like setargv (Visual C) or wildargs (Borland), in the compiles. Wildcard processing in MinGW was excluded by adding "int _CRT_glob = 0" as a global variable. (It could also be excluded by linking to CRT_noglob.o). Artistic Style now does the wildcard processing internally.

When processing directories recursively it is sometimes necessary to exclude certain files or directories. This can be done using a new exclude (‑‑exclude=file‑or‑directory) option. There is no short option. Multiple exclude statements are allowed. The Other Options section of the documentation contains the details.

It is always a good idea to create a backup for files that have been formatted. This can cause a problem in that it creates a lot of excess files in your source directories. There are now new script files available that will move the files to a backup directory. The original directory structure will be maintained the in the backup. There is a batch file for Windows and a shell script for everyone else. They are available in the Scripts section of the home page.

There is a new Links page that lists programs using Artistic Style. In general, they seem to be good quality software.

If you are using a development environment to compile Artistic Style, be sure to read the Compiler Options section in the Install Information. In particular, you should define NDEBUG in the Release compile to remove the assert statements. There are quite a few of these and they will slow down processing if NDEBUG is not used. The assert statements are necessary due to the nature of the program. Also, when reporting bugs it is a good idea to log in first. Occasionally, more information is needed on a problem. If the poster did not log in there is no way to contact them.

A Java Native Interface has been added for Java developers. This will allow an Artistic Style shared library (DLL) to be called from a Java program. A shared library (Dll) using the Java interface can still be called from C, C++, or C# programs. There is a sample program in the Developer Information.

Developers using Artistic Style in another project should be aware that there are two new functions that have been added to the ASStreamIterator class (peekNextLine() and peekReset()). These will have to be coded into source modules which use Artistic Style without astyle_main. In most cases the functions can simply be copied without the template information. The assert statements may also be removed. A variable will need to be added to the class and another may need to be modified. If the shared or static library configuration is being used then no changes are necessary.

The file globing function was obtained from "The Code Project" and was written by Jack Handy. It was modified slightly to make the comparisons case insensitive for Windows.

The OpenVMS distribution is prepared by Jim Duff, an OpenVMS Systems Specialist living in Sydney, Australia. His website is eight‑cubed.com.

Thanks to Emilio Guijarro and Jens Krinke for their contributions, and to Sam Cooler for testing the Mac OS X version.

### Artistic Style 1.21 (June 2007)

This release contains many bug fixes. Array formatting and indentation has been improved. Arrays and enums are now formatted by a different procedure than functions. Brackets will now attach to lines with comments. Brackets will be broken from lines with comments without bringing the comments with them. All comments will remain in their original column, if possible. The formatting of empty blocks was fixed. The BracketType definition was expanded and the bracket types are now correctly identified. There are several formatting fixes for Java files. See the Release Notes for a complete list of changes.

A new option, --preserve-date (-Z), has been added. This will retain the date modified of the original file in the new formatted file. Otherwise the new file will contain the current date.

The option --errors-to-standard-output has been shortened to --errors-to-stdout. The short options -c (mode=c) and -j (mode=java) have been removed. The options should seldom be needed since the mode is now set automatically from the file extension for each source file instead of for each program execution. A new long option --mode=cs (C#) has been added. Key words are now set for each file depending on the file mode (C, Java, or C#). This will eliminate formatting problems caused by not being able to identify the source code language.

There has been a change to the Linux style bracket formatting for C++ header files. In the past brackets have been broken for function definitions within a class. With this release the brackets will be attached. The brackets will also be attached for arrays, structs, enums, and other top level objects that are not classes or functions. The Linux style formatting for Java and C# has not been changed.

This release supports only one platform in each distribution package. In the past all platforms were included in every 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 directory and the line endings. The source code and documentation are the same for all packages.

There are new instructions about optimizing compiler options in the Install Instructions. If you are compiling using a development environment you may want to read them.

If you have broken brackets with comments attached to the opening bracket instead of the previous line, do the following before formatting again with broken brackets. Use the current Artistic Style release (1.21). Format the source using attached brackets to reattach the brackets and the comments to the previous line. Then format the source again using broken brackets. This will move the brackets to the next line without the comments. The comments will now be on the correct line.

There is a new multi-platform GUI program, UniversalIndent, available at sourceforge.net/projects/universalindent. It allows you to view the effects of the Artistic Style options on your source code without saving the file. You can review the results of the formatting options before updating the file. It can be used with a test file or with your actual source code. It supports several other formatting programs. The Artistic Style for Windows program has been updated to support the current release. It is available at jimp03.zxq.net

There have been a few inquiries about how to customize Artistic Style for an unsupported format. Changes can be made with Python or another text processing program after formatting the source, or you can modify the Artistic Style source code itself. The best place to modify the code is usually in ASEnhancer.cpp. The ASEnhancer class is called after the main formatting has been done so you are getting a formatted file. If you just need to change the indentation of a few things this is probably the best place to do it.

There is now a distribution package for OpenVMS thanks to Jim Duff, an OpenVMS Systems Specialist living in Sydney Australia. His website is at eight-cubed.com.

Thanks to Norbert Holzki and Siemens AG, Medical Solutions, Forchheim, Germany for testing the array formatting.

Thanks to Sam Cooler for testing the Mac OS X version.

### Artistic Style 1.20 (January 2007)

Release 1.20.2 fixed problems with the new stream I/O procedure added in release 1.20.1. Release 1.20.1 improved the processing for Mac OS X platforms. The compatibility with TextWrangler was improved. There is now a separate release for Mac.

Artistic Style will now indent message maps for Microsoft Foundation Class (MFC) and event tables for wxWidgets. The option --brackets=break-closing-headers has been shortened to --brackets=break-closing and a short option added (-y). There have been short options added for --break-elseifs (-e), --indent-preprocessor (-w), --break-blocks (-f), and --break-blocks=all (-F).

With this release the Artistic Style license changes from the GNU General Public License (GPL) to the GNU Lesser General Public License (LGPL). You can use Artistic Style for free or commercial software without charge. Projects that use Artistic Style do not have to make the their source code available. If Artistic Style itself is modified, however, the modified Artistic Style source code must be made available. See the GNU Lesser General Public License for more information.

There is a new preprocessor option to aid developers in using Artistic Style with a Graphical User Interface (GUI). It is no longer necessary to remove the source module astyle_main.cpp and write embedded code to call the formatter. It can be compiled as a static library or a shared library (DLL), or the entire source code can be included in the project. See the Artistic Style Developer Information for the calling procedure and other details.

There is a sample GUI program for Windows available at http://jimp03.zxq.net/. It uses the unmodified Artistic Style compiled for a GUI. The source code needs some work so it is not available for now. It should work under Linux using WINE. Future enhancements and platform support will depend on the response to the sample program.

To support the new Artistic Style preprocessor option there are new makefiles and project files. Windows users have a project file for Microsoft Visual C++ 2003 (version 7). Linux users have a new makefile that has several new options. The location of both files is in the build directory. Be sure to read the "Artistic Style Install Information" for the details.

Intel® is now offering it's C++ and Fortran compilers free for non-commercial use. Information is available at the Intel® Software Development Products website. Click on the "Free Non-Commercial Download" link to see if you qualify. The Intel Compilers on Windows and Linux require that other compilers be installed (Microsoft Visual C++ or GNU gcc respectively). This is because the Intel Compilers require the header files, runtime libraries and linkers distributed as part of these other compilers. If you want to use this compiler there is now a makefile (makeintel) included with the project. See "Artistic Style Install Information" for instructions.

### Artistic Style 1.19 (July 2006)

Most changes this release were again concerned with the options pad=oper and pad=paren. The formatting still worked a little different if both options were declared than if only one was used. The problems with distinguishing the multiplication operator from pointers, and of separating an object from the member access pointer (->) were fixed.

A new option, unpad=paren, was added. This will undo the pad=paren, pad=paren-out and pad=paren-in options. It can be used alone or with pad=paren-out or pad=paren-in. If used alone it will unpad all parens that have been previously padded. If used with a paren padding option, the paren padding option will take precedence and only the unnecessary padding will be removed. This will enable the paren padding to be changed in one formatting run.

Padding to paren headers (e.g. "if", "for", "while") was reinstated. This was done in previous releases if pad=oper was used. Since most people used this option, the headers were usually padded. The general opinion was that they looked better padded, especially in the case of "else if" statements. Since it is a minor point, it was not made an option.

This is the third release of Artistic Style in the last four months. The reason for the frequent releases was the number of pervasive errors in the formatting. In the future there will probably be two or three new releases per year, or one every four to six months. It will take about three years to make all the changes that are planned at this time.; The releases will be a combination of fixes, changes to formatting, and new features.