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.
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 www.geocities.com/jpattee/
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.
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://www.geocities.com/jpattee/. 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.
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.