Upgrade to SVN r511
This commit is contained in:
parent
c8638db9b4
commit
a80ed8000a
21
LICENSE.txt
Normal file
21
LICENSE.txt
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 by Jim Pattee <jimp03@email.com>.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
1380
doc/astyle.html
1380
doc/astyle.html
File diff suppressed because it is too large
Load Diff
BIN
doc/favicon.ico
Normal file
BIN
doc/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 318 B |
477
doc/install.html
477
doc/install.html
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<title>Artistic Style - Install Information</title>
|
||||
@ -12,401 +12,335 @@
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Artistic Style Install Information
|
||||
</h1>
|
||||
<h1>Artistic Style Install Information</h1>
|
||||
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</p>
|
||||
|
||||
<h3 id="Contents">
|
||||
Contents
|
||||
</h3>
|
||||
<h3 id="Contents">Contents</h3>
|
||||
|
||||
<p class="contents1">
|
||||
<a class="contents" href="#_Artistic_Style_Versions">Artistic Style Versions</a>
|
||||
</p>
|
||||
<a class="contents" href="#_Artistic_Style_Versions">Artistic Style Versions</a></p>
|
||||
<p class="contents1">
|
||||
<a class="contents" href="#_Linux_Version">Linux Version</a>
|
||||
</p>
|
||||
<a class="contents" href="#_Linux_Version">Linux Version</a></p>
|
||||
<p class="contents2">
|
||||
<a class="contents" href="#_GCC_Compiler">GCC Compiler</a>
|
||||
</p>
|
||||
<a class="contents" href="#_GCC_Compiler">GCC Compiler</a></p>
|
||||
<p class="contents2">
|
||||
<a class="contents" href="#_Other_Makefile_Options">Other Makefile Options</a>
|
||||
</p>
|
||||
<a class="contents" href="#_Clang_Compiler">Clang Compiler</a></p>
|
||||
<p class="contents2">
|
||||
<a class="contents" href="#_Clang_Compiler">Clang Compiler</a>
|
||||
</p>
|
||||
<a class="contents" href="#_Intel_Compiler">Intel Compiler</a></p>
|
||||
<p class="contents2">
|
||||
<a class="contents" href="#_Intel_Compiler">Intel Compiler</a>
|
||||
</p>
|
||||
<a class="contents" href="#_Other_Makefile_Targets">Other Makefile Targets</a></p>
|
||||
<p class="contents1">
|
||||
<a class="contents" href="#_Mac_OS_X_Version">Mac OS X Version</a>
|
||||
</p>
|
||||
<a class="contents" href="#_Mac_OS_Version">Mac OS Version</a></p>
|
||||
<p class="contents2">
|
||||
<a class="contents" href="#_Xcode">Xcode</a>
|
||||
</p>
|
||||
<a class="contents" href="#_Xcode">Xcode</a></p>
|
||||
<p class="contents2">
|
||||
<a class="contents" href="#_Makefile">Makefile</a>
|
||||
</p>
|
||||
<a class="contents" href="#_Makefile">Makefile</a></p>
|
||||
<p class="contents1">
|
||||
<a class="contents" href="#_Windows_Version">Windows Version</a>
|
||||
</p>
|
||||
<a class="contents" href="#_Windows_Version">Windows Version</a></p>
|
||||
<p class="contents2">
|
||||
<a class="contents" href="#_Precompiled_Executable">Precompiled Executable</a>
|
||||
</p>
|
||||
<a class="contents" href="#_Precompiled_Executable">Precompiled Executable</a></p>
|
||||
<p class="contents2">
|
||||
<a class="contents" href="#_Visual_C++_Compiler">Visual C++ Compiler</a>
|
||||
</p>
|
||||
<a class="contents" href="#_Visual_C++_Compiler">Visual C++ Compiler</a></p>
|
||||
<p class="contents2">
|
||||
<a class="contents" href="#_Other_Compilers">Other Compilers</a>
|
||||
</p>
|
||||
<a class="contents" href="#_Other_Compilers">Other Compilers</a></p>
|
||||
<p class="contents1">
|
||||
<a class="contents" href="#_Compiler_Options">Compiler Options</a>
|
||||
</p>
|
||||
<a class="contents" href="#_Compiler_Options">Compiler Options</a></p>
|
||||
|
||||
<h3 id="_Artistic_Style_Versions">
|
||||
Artistic Style Versions
|
||||
</h3>
|
||||
<h3 id="_Artistic_Style_Versions">Artistic Style Versions</h3>
|
||||
|
||||
<p>
|
||||
astyle_x.x_linux.tar.gz is the <b>Linux </b>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.
|
||||
</p>
|
||||
astyle_x.x_linux.tar.gz is the <strong>Linux </strong>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.</p>
|
||||
<p>
|
||||
astyle_x.x_macosx.tar.gz is the <b>Mac OS X </b>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.
|
||||
</p>
|
||||
astyle_x.x_macos.tar.gz is the <strong>Mac OS </strong>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.</p>
|
||||
<p>
|
||||
astyle_x.x_windows.zip is the <b>Windows </b>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.
|
||||
</p>
|
||||
astyle_x.x_windows.zip is the <strong>Windows </strong>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.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
code and documentation are the same for all distributions.</p>
|
||||
|
||||
<h3 id="_Linux_Version">
|
||||
Linux Version
|
||||
</h3>
|
||||
<h3 id="_Linux_Version">Linux Version</h3>
|
||||
|
||||
<h4 id="_GCC_Compiler">
|
||||
GCC Compiler
|
||||
</h4>
|
||||
<h4 id="_GCC_Compiler">GCC Compiler</h4>
|
||||
|
||||
<p>
|
||||
To compile using the GCC compiler you must have GCC (3.1 or better) installed.
|
||||
</p>
|
||||
To compile using the GCC compiler you must have GCC (3.1 or better) installed.</p>
|
||||
<p>
|
||||
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:
|
||||
</p>
|
||||
line configuration enter the following:</p>
|
||||
<pre>cd astyle/build/gcc<br />make
|
||||
</pre>
|
||||
<p>
|
||||
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:
|
||||
</p>
|
||||
parens) of the various configurations:</p>
|
||||
<ul>
|
||||
<li><b>release </b>builds the Artistic Style command line program (astyle). This is the default option.</li>
|
||||
<li><b>shared </b>builds the Artistic Style program as a shared library (libastyle.so).</li>
|
||||
<li><b>static </b>builds the Artistic Style program as a static library (libastyle.a).</li>
|
||||
<li><b>debug </b>builds the Artistic Style command line program with debugging information (astyled).</li>
|
||||
<li><b>shareddebug </b>builds the Artistic Style program as a shared library with debugging information (libastyled.so).
|
||||
<li><strong>release </strong>builds the Artistic Style command line program (astyle). This is the default option.
|
||||
</li>
|
||||
<li><b>staticdebug </b>builds the Artistic Style program as a static library with debugging information (libastyled.a).
|
||||
<li><strong>shared </strong>builds the Artistic Style program as a shared library (libastyle.so).</li>
|
||||
<li><strong>static </strong>builds the Artistic Style program as a static library (libastyle.a).</li>
|
||||
<li><strong>debug </strong>builds the Artistic Style command line program with debugging information (astyled).
|
||||
</li>
|
||||
<li><b>all </b>builds all the above configurations.
|
||||
<li><strong>shareddebug </strong>builds the Artistic Style program as a shared library with debugging information
|
||||
(libastyled.so).
|
||||
</li>
|
||||
<li><strong>staticdebug </strong>builds the Artistic Style program as a static library with debugging information
|
||||
(libastyled.a).
|
||||
</li>
|
||||
<li><strong>all </strong>builds all the above configurations.
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
6. If the compile cannot find the file jni.h, either set the variable or change the value in the
|
||||
makefile.</p>
|
||||
</li>
|
||||
<li><b>java </b>builds the Artistic Style program as a shared library which includes the JNI (libastylej.so).</li>
|
||||
<li><b>javadebug </b>builds the Artistic Style program as a shared library which includes the JNI and debugging information
|
||||
<li><strong>java </strong>builds the Artistic Style program as a shared library which includes the JNI (libastylej.so).
|
||||
</li>
|
||||
<li><strong>javadebug </strong>builds the Artistic Style program as a shared library which includes the JNI and debugging
|
||||
information
|
||||
(libastylejd.so).</li>
|
||||
<li><span style="font-weight: bold;">javaall </span>builds all the above java configurations.</li>
|
||||
</ul>
|
||||
<p>
|
||||
More than one configuration can be built at the same time. For example, to build all the release configurations
|
||||
enter:
|
||||
</p>
|
||||
enter:</p>
|
||||
<pre>cd astyle/build/gcc<br />make release shared static</pre>
|
||||
<p>
|
||||
The <a href="#_Other_Makefile_Targets">Other Makefile Targets</a> section contains additional target
|
||||
options.</p>
|
||||
|
||||
<h4 id="_Other_Makefile_Options">
|
||||
Other Makefile Options
|
||||
</h4>
|
||||
<h4 id="_Clang_Compiler">Clang Compiler</h4>
|
||||
|
||||
<p>
|
||||
The following makefile options are available for GCC, Clang, Intel, and Mac.
|
||||
</p>
|
||||
<h5>clean
|
||||
</h5>
|
||||
<p>
|
||||
Removes the object and executable files for all configurations.
|
||||
</p>
|
||||
<p>
|
||||
To remove the files for all configurations:
|
||||
</p>
|
||||
<pre>make clean
|
||||
</pre>
|
||||
<h5>cleanobj
|
||||
</h5>
|
||||
<p>
|
||||
Removes the object files for all configurations. The executables will not be removed.
|
||||
</p>
|
||||
<p>
|
||||
To remove only the object files for all configurations:
|
||||
</p>
|
||||
<pre>make cleanobj
|
||||
</pre>
|
||||
<h5>install
|
||||
</h5>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
To install the astyle to the default directories:
|
||||
</p>
|
||||
<pre>sudo make install
|
||||
</pre>
|
||||
<p>
|
||||
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/<i>user</i>/bin):
|
||||
</p>
|
||||
<pre>sudo make prefix=$HOME install
|
||||
</pre>
|
||||
<h5>uninstall
|
||||
</h5>
|
||||
<p>
|
||||
Uninstalls the executable and documentation. You must have the appropriate permissions to use uninstall.
|
||||
</p>
|
||||
<p>
|
||||
To uninstall astyle from the default directories:
|
||||
</p>
|
||||
<pre>sudo make uninstall
|
||||
</pre>
|
||||
<p>
|
||||
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/<i>user</i>):
|
||||
</p>
|
||||
<pre> sudo make prefix=$HOME uninstall
|
||||
</pre>
|
||||
<p>
|
||||
NOTE: The uninstall option will NOT remove the .astylerc files from the users home directories. The files must
|
||||
be removed individually for each user.
|
||||
</p>
|
||||
|
||||
<h4 id="_Clang_Compiler">
|
||||
Clang Compiler
|
||||
</h4>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
the analysis on Artistic Style.</p>
|
||||
<p>
|
||||
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:
|
||||
</p>
|
||||
line configuration enter the following:</p>
|
||||
<pre>cd astyle/build/clang<br />make
|
||||
</pre>
|
||||
<p>
|
||||
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 <a href="#_GCC_Compiler">GCC compiler</a>. More than one configuration can be
|
||||
built at the same time. For example, to build all the release configurations enter:
|
||||
</p>
|
||||
built at the same time. For example, to build all the release configurations enter:</p>
|
||||
<pre>cd astyle/build/clang<br />make release shared static
|
||||
</pre>
|
||||
<p>
|
||||
The <a href="#_Other_Makefile_Options">Other Makefile Options</a> are the same as for the GCC compiler.
|
||||
</p>
|
||||
The <a href="#_Other_Makefile_Targets">Other Makefile Targets</a> section contains additional target
|
||||
options.</p>
|
||||
|
||||
<h4 id="_Intel_Compiler">
|
||||
Intel Compiler
|
||||
</h4>
|
||||
<h4 id="_Intel_Compiler">Intel Compiler</h4>
|
||||
|
||||
<p>
|
||||
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".
|
||||
</p>
|
||||
Instructions for your compiler are in the compiler documentation file "get_started_lc.htm".</p>
|
||||
<p>
|
||||
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: "<strong>source <install-dir>/bin/compilervars.sh <arg></strong>",
|
||||
where <install-dir> is the directory where the compiler is installed and <arg> is <strong>ia32 </strong>
|
||||
or <strong>intel64</strong>. 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
|
||||
</p>
|
||||
variables are not set." On an Intel x64 platform installed in the default directory the instruction would
|
||||
be</p>
|
||||
<pre>source /opt/intel/bin/compilervars.sh intel64</pre>
|
||||
<p>
|
||||
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:
|
||||
</p>
|
||||
the command line configuration enter the following:</p>
|
||||
<pre>cd astyle/build/intel<br />make</pre>
|
||||
<p>
|
||||
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 <a href="#_GCC_Compiler">GCC compiler</a>. More than one configuration can be
|
||||
built at the same time. For example, to build the entire debug configurations enter:
|
||||
</p>
|
||||
built at the same time. For example, to build the entire debug configurations enter:</p>
|
||||
<pre>cd astyle/build/intel<br />make debug shareddebug staticdebug</pre>
|
||||
<p>
|
||||
The <a href="#_Other_Makefile_Options">Other Makefile Options</a> are the same as for the GCC compiler.
|
||||
</p>
|
||||
The <a href="#_Other_Makefile_Targets">Other Makefile Targets</a> section contains additional target
|
||||
options.</p>
|
||||
|
||||
<h3 id="_Mac_OS_X_Version">
|
||||
Mac OS X Version
|
||||
</h3>
|
||||
<h4 id="_Other_Makefile_Targets">Other Makefile Targets</h4>
|
||||
|
||||
<p>
|
||||
The following makefile targets are available for GCC, Clang, Intel, and Mac.</p>
|
||||
|
||||
<h5>clean</h5>
|
||||
|
||||
<p>
|
||||
Removes the object and executable files for all configurations.</p>
|
||||
<p>
|
||||
To remove the files for all configurations:</p>
|
||||
<pre>make clean
|
||||
</pre>
|
||||
|
||||
<h5>cleanobj</h5>
|
||||
|
||||
<p>
|
||||
Removes the object files for all configurations. The executables will not be removed.</p>
|
||||
<p>
|
||||
To remove only the object files for all configurations:</p>
|
||||
<pre>make cleanobj
|
||||
</pre>
|
||||
|
||||
<h5>install</h5>
|
||||
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
To install the astyle to the default directories:</p>
|
||||
<pre>sudo make install
|
||||
</pre>
|
||||
<p>
|
||||
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/<i>user</i>/bin):</p>
|
||||
<pre>sudo make prefix=$HOME install
|
||||
</pre>
|
||||
|
||||
<h5>uninstall</h5>
|
||||
|
||||
<p>
|
||||
Uninstalls the executable and documentation. You must have the appropriate permissions to use uninstall.</p>
|
||||
<p>
|
||||
To uninstall astyle from the default directories:</p>
|
||||
<pre>sudo make uninstall
|
||||
</pre>
|
||||
<p>
|
||||
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/<i>user</i>):</p>
|
||||
<pre> sudo make prefix=$HOME uninstall
|
||||
</pre>
|
||||
<p>
|
||||
NOTE: The uninstall option will NOT remove the .astylerc files from the users home directories. The files must
|
||||
be removed individually for each user.</p>
|
||||
|
||||
<h3 id="_Mac_OS_Version">Mac OS Version</h3>
|
||||
|
||||
<h4 id="_Xcode">Xcode</h4>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
and Release configurations. The following projects are available.</p>
|
||||
<ul>
|
||||
<li><b>AStyle</b> builds the Artistic Style command line program (astyle). </li>
|
||||
<li><b>AStyleA</b> builds the Artistic Style program as a Static Library (libastyle.a). This can be statically
|
||||
<li><strong>AStyle</strong> builds the Artistic Style command line program (astyle). </li>
|
||||
<li><strong>AStyleA</strong> builds the Artistic Style program as a Static Library (libastyle.a). This can be statically
|
||||
linked with an executable.</li>
|
||||
<li><b>AStyleDylib</b> builds the Artistic Style program as a Dynamic Library (libastyle.dylib). It can be used with C/C++, Objective
|
||||
C, C#, and Python programs.</li>
|
||||
<li><b>AStyleJava</b> builds the Artistic Style program as a Dynamic Library (libastylej.dylib) that can be called
|
||||
from a Java program. The Java Development (JDK) is required for the project to compile. The Project Properties
|
||||
must have an include path to the JDK include directory. The output dylib can also be called from a C++ or C#
|
||||
program.</li>
|
||||
<li><strong>AStyleDylib</strong> builds the Artistic Style program as a Dynamic Library (libastyle.dylib). It can
|
||||
be used with C/C++, Objective C, C#, and Python programs.</li>
|
||||
<li><strong>AStyleJava</strong> builds the Artistic Style program as a Dynamic Library (libastylej.dylib) that can
|
||||
be called from a Java program. The Java Development (JDK) is required for the project to compile. The Project
|
||||
Properties must have an include path to the JDK include directory. The output dylib can also be called from a
|
||||
C++ or C# program.</li>
|
||||
</ul>
|
||||
|
||||
<h5>install</h5>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
If sudo is not used for the install an error will occur during the build.</p>
|
||||
<p>
|
||||
To install the astyle executable to the default directory:
|
||||
</p>
|
||||
To install the astyle executable to the default directory:</p>
|
||||
<pre>cd astyle/build/xcode
|
||||
sudo xcodebuild install -project AStyle.xcodeproj
|
||||
</pre>
|
||||
<p>
|
||||
A script is used to install the documentation
|
||||
from the same directory.
|
||||
</p>
|
||||
from the same directory.</p>
|
||||
<pre>sudo bash install.sh
|
||||
</pre>
|
||||
<h5>uninstall
|
||||
</h5>
|
||||
|
||||
<h5>uninstall</h5>
|
||||
|
||||
<p>
|
||||
Uninstalls the executable and documentation. You must have the appropriate permissions to use uninstall.
|
||||
</p>
|
||||
Uninstalls the executable and documentation. You must have the appropriate permissions to use uninstall.</p>
|
||||
<p>
|
||||
A script is used to uninstall astyle and the documentation:
|
||||
</p>
|
||||
A script is used to uninstall astyle and the documentation:</p>
|
||||
<pre>sudo bash uninstall.sh
|
||||
</pre>
|
||||
<p>
|
||||
NOTE: The uninstall option will NOT remove the .astylerc files from the users home directories. The files must
|
||||
be removed individually for each user.
|
||||
</p>
|
||||
be removed individually for each user.</p>
|
||||
|
||||
<h4 id="_Makefile">Makefile</h4>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
tools in /usr/bin.</p>
|
||||
<p>
|
||||
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:
|
||||
</p>
|
||||
line configuration enter the following:</p>
|
||||
<pre>cd astyle/build/mac<br />make
|
||||
</pre>
|
||||
<p>
|
||||
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 <a href="#_GCC_Compiler">Linux GCC compiler</a>. More than one configuration can be
|
||||
built at the same time. For example, to build all the release configurations enter:
|
||||
</p>
|
||||
built at the same time. For example, to build all the release configurations enter:</p>
|
||||
<pre>cd astyle/build/mac<br />make release shared static
|
||||
</pre>
|
||||
<p>
|
||||
The <a href="#_Other_Makefile_Options">Other Makefile Options</a> are the same as for the Linux GCC compiler.
|
||||
</p>
|
||||
The <a href="#_Other_Makefile_Targets">Other Makefile Targets</a> section contains additional target
|
||||
options.</p>
|
||||
|
||||
<h3 id="_Windows_Version">
|
||||
Windows Version
|
||||
</h3>
|
||||
<h3 id="_Windows_Version">Windows Version</h3>
|
||||
|
||||
<h4 id="_Precompiled_Executable">
|
||||
Precompiled Executable
|
||||
</h4>
|
||||
<h4 id="_Precompiled_Executable">Precompiled Executable</h4>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
(AStyle.exe). If you prefer to compile the executable yourself follow the following instructions.</p>
|
||||
|
||||
<h4 id="_Visual_C++_Compiler">
|
||||
Visual C++ Compiler
|
||||
</h4>
|
||||
<h4 id="_Visual_C++_Compiler">Visual C++ Compiler</h4>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
directory. Static file output will be in the "binstatic" directory. The following solution files are
|
||||
available.</p>
|
||||
<ul>
|
||||
<li><b>All AStyle </b>builds the release and the debug configurations for all the following.</li>
|
||||
<li><b>AStyle </b>builds the Artistic Style command line program (AStyle.exe). This project has an extra "Static"
|
||||
option. It is the same as the "Release" build except that it is linked with a static runtime library. This is
|
||||
needed if the executable is to be run on a system without Visual Studio installed. The builds for this configuration
|
||||
are placed in a separate "binstatic" directory. </li>
|
||||
<li><b>AStyleDll </b>builds the Artistic Style program as a Dynamic Link Library (AStyle.dll). This will also build
|
||||
an exports library and a static library for linking the dll. </li>
|
||||
<li><b>AStyleJava </b>builds the Artistic Style program as a Dynamic Link Library (AStylej.dll) that can be called
|
||||
from a Java program. The Java Development (JDK) is required for the project to compile. The Project Properties
|
||||
must have an include path to the JDK include and include/win32 directories. This is set in "Project >
|
||||
Properties > C/C++ > General > Additional Include Directories". The default setting is
|
||||
for the JDK to be installed in the default directory, but it may not be the most current release. The output DLL
|
||||
can also be called from a C++ or C# program.</li>
|
||||
<li><b>AStyleLib </b>builds the Artistic Style program as a Static Library (libAStyle.lib). This can be statically
|
||||
linked to a calling program.</li>
|
||||
<li><strong>All AStyle ll AStyle </strong>builds the release and the debug configurations for all the following.
|
||||
</li>
|
||||
<li><strong>AStyle </strong>builds the Artistic Style command line program (AStyle.exe). This project has an extra
|
||||
"Static" option. It is the same as the "Release" build except that it is linked with a static runtime library.
|
||||
This is needed if the executable is to be run on a system without Visual Studio installed. The builds for this
|
||||
configuration are placed in a separate "binstatic" directory. </li>
|
||||
<li><strong>AStyleDll </strong>builds the Artistic Style program as a Dynamic Link Library (AStyle.dll). This will
|
||||
also build an exports library and a static library for linking the dll. </li>
|
||||
<li><strong>AStyleJava </strong>builds the Artistic Style program as a Dynamic Link Library (AStylej.dll) that can
|
||||
be called from a Java program. The Java Development (JDK) is required for the project to compile. The Project
|
||||
Properties must have an include path to the JDK include and include/win32 directories. This is set in "Project
|
||||
> Properties > C/C++ > General > Additional Include Directories". The default setting
|
||||
is for the JDK to be installed in the default directory, but it may not be the most current release. The output
|
||||
DLL can also be called from a C++ or C# program.</li>
|
||||
<li><strong>AStyleLib </strong>builds the Artistic Style program as a Static Library (libAStyle.lib). This can be
|
||||
statically linked to a calling program.</li>
|
||||
</ul>
|
||||
|
||||
<h4 id="_Other_Compilers">
|
||||
Other Compilers
|
||||
</h4>
|
||||
<h4 id="_Other_Compilers">Other Compilers</h4>
|
||||
|
||||
<p>
|
||||
To use other compilers a project file must be built using a development environment.
|
||||
</p>
|
||||
To use other compilers a project file must be built using a development environment.</p>
|
||||
<ul>
|
||||
<li>Create a project using the compiler's development environment.</li>
|
||||
<li>Add to the project all the .cpp and .h files in the "src" directory.</li>
|
||||
@ -414,61 +348,32 @@ sudo xcodebuild install -project AStyle.xcodeproj
|
||||
<li>Compile.</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="_Compiler_Options">
|
||||
Compiler Options
|
||||
</h3>
|
||||
<h3 id="_Compiler_Options">Compiler Options</h3>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
options to compile the debug versions.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
on the compiler.</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</p>
|
||||
|
||||
<center style="margin-left: -0.4in;">
|
||||
<p style="margin-left: -0.4in; text-align: center;">
|
||||
<a href="http://sourceforge.net/projects/astyle">
|
||||
<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2319&type=16" alt="" />
|
||||
</a>
|
||||
</center>
|
||||
</a></p>
|
||||
|
||||
<p>
|
||||
|
||||
</p>
|
||||
|
||||
<!-- Piwik -->
|
||||
|
||||
<script type="text/javascript">
|
||||
var pkBaseURL = (("https:" == document.location.protocol) ? "https://sourceforge.net/apps/piwik/astyle/" : "http://sourceforge.net/apps/piwik/astyle/");
|
||||
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
|
||||
piwikTracker.trackPageView();
|
||||
piwikTracker.enableLinkTracking();
|
||||
} catch (err) { }
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<p>
|
||||
<img src="http://sourceforge.net/apps/piwik/astyle/piwik.php?idsite=1" style="border: 0" alt="" />
|
||||
</p>
|
||||
</noscript>
|
||||
|
||||
<!-- End Piwik Tag -->
|
||||
</p>
|
||||
|
||||
</body>
|
||||
|
||||
|
435
doc/news.html
435
doc/news.html
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<title>Artistic Style - News</title>
|
||||
@ -15,167 +15,332 @@
|
||||
<h1>Artistic Style News</h1>
|
||||
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</p>
|
||||
|
||||
<h3>Artistic Style 2.06 (Pending)</h3>
|
||||
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
The Objective-C align-method-colon option is now applied to Objective-C method calls in
|
||||
addition to method declarations and definitions.</p>
|
||||
<p>
|
||||
Processing for C++14 single-quote digit separators has been added.</p>
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
</p>
|
||||
|
||||
<h4>Visual Studio 2015 UTF-8 Files</h4>
|
||||
|
||||
<p>
|
||||
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
|
||||
<a href="https://blogs.msdn.microsoft.com/vcblog/2016/02/22/new-options-for-managing-character-sets-in-the-microsoft-cc-compiler/"
|
||||
target="_blank" title="open new window">here</a>.
|
||||
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.</p>
|
||||
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
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". </p>
|
||||
<p>
|
||||
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.</p>
|
||||
|
||||
<h4>New Software License</h4>
|
||||
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
If there are problems with the license change send an email to Artistic Style and its use will be approved on
|
||||
a individual basis.</p>
|
||||
|
||||
<h4>Assignment Operator Alignment</h4>
|
||||
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
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.</p>
|
||||
|
||||
<h4>Microsoft Clang Compiler</h4>
|
||||
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
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".</p>
|
||||
<p>
|
||||
To use Clang open a Visual Studio 2015 AStyle Solution. Make the following change to all configurations: </p>
|
||||
<ul>
|
||||
<li>General > Platform Toolset, select "Clang with Microsoft CodeGen".</li>
|
||||
</ul>
|
||||
<p>
|
||||
Make sure to hit "Apply" before editing other properties to let the project system load the corresponding
|
||||
toolset definition.</p>
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
The properties that need changing in Visual Studio 2015 Update 2 and 3 are:</p>
|
||||
<ul>
|
||||
<li>C/C++ > General > Debug Information Format, select "Full Debug Information (DWARF2)" for Debug
|
||||
or "None" for Release.</li>
|
||||
<li>C/C++ > General > Warning Level, select "Enable All Warnings".</li>
|
||||
<li>C/C++ > Optimization > Optimization, select an appropriate valid value for each configuration.</li>
|
||||
<li>C/C++ > Code Generation > Enable C++ Exceptions, select "Yes" for Debug or "No" for
|
||||
Release.</li>
|
||||
<li>C/C++ > Precompiled Headers > Precompiled Header, select "Not Using Precompiled Headers".</li>
|
||||
</ul>
|
||||
<p>
|
||||
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.</p>
|
||||
<ul>
|
||||
<li>C/C++ > Preprocessor > Preprocessor Definitions, add " __STDC__=0".
|
||||
</li>
|
||||
<li>C/C++ > Command Line > Additional Options, enter "-Wno-macro-redefined".
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
The project should now compile and run.</p>
|
||||
|
||||
<h4>Artistic Style Wx</h4>
|
||||
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
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. </p>
|
||||
<p>
|
||||
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.</p>
|
||||
|
||||
<h4>Windows XP</h4>
|
||||
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
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.</p>
|
||||
<p>
|
||||
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:</p>
|
||||
<ul>
|
||||
<li>"Windows XP Support for C++" must be installed. It is available as an option in the Visual Studio install
|
||||
and can be installed as a modification to the current install.</li>
|
||||
<li>In the Artistic Style Properties, change General > Platform Toolset, to "Windows XP" for your Visual
|
||||
Studio version.</li>
|
||||
<li>In the Artistic Style Properties, change C/C++ > Preprocessor > Preprocessor Definitions to include
|
||||
_USING_V110_SDK71_.</li>
|
||||
<li>Change other Properties if you want, such as Output Directory or Target Name.</li>
|
||||
<li>Compile. The output should be executable on Windows XP. It will also execute on the later versions of Windows.
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
In newer releases of Visual Studio 2015, the "Universal CRT" files have been moved. There is a
|
||||
notification at <a href="https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/">https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/</a>.
|
||||
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.</p>
|
||||
|
||||
|
||||
<h4>Acknowledgments</h4>
|
||||
|
||||
<p>
|
||||
Thanks to David Faure for their contributions.</p>
|
||||
|
||||
<h3>Artistic Style 2.05 (November 2014)</h3>
|
||||
|
||||
<p>Release 2.05.1 (December 2014) is a maintenance release and no new features were added. A list of changes is in
|
||||
<p>
|
||||
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.</p>
|
||||
|
||||
<p>
|
||||
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/).
|
||||
</p>
|
||||
style is available at the "Visualization Toolkit" website (http://www.vtk.org/).</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
The option is described in the "Indentation Options" section of the documentation.</p>
|
||||
<p>
|
||||
A new option, "dry-run", will run Artistic Style without updating the files. The report will be output as usual.
|
||||
</p>
|
||||
A new option, "dry-run", will run Artistic Style without updating the files. The report will be output as
|
||||
usual.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
of a single line. This should allow any custom formatting to be retained.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
versions of a shared library on the same system without conflicts.</p>
|
||||
<p>
|
||||
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."
|
||||
</p>
|
||||
symbol clashes. It is strongly recommended that you use this in any shared objects you distribute."</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
have been fixed.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
It is sometimes needed for static libraries on other compilers to prevent error and warning messages.</p>
|
||||
<p>
|
||||
Qt and Boost macros foreach, forever, Q_FOREACH, and Q_FOREVER will now be recognized as headers.
|
||||
</p>
|
||||
Qt and Boost macros foreach, forever, Q_FOREACH, and Q_FOREVER will now be recognized as headers.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
documentation. The option is available only from the command line.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
More information is in the "Command Line Only" section of the documentation.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
documentation takes quite a bit of effort to maintain and I would like to make it easily available.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
will page the display. The "version" option has also been changed to stdout.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
some cases this may cause compile errors in a user program until the references have been changed.</p>
|
||||
<p>
|
||||
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).
|
||||
</p>
|
||||
be removed in a future release. Use one of the other long options instead (style=allman, style=bsd, or
|
||||
style=break).</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
install and run Artistic Style. The included files can be used without an Internet connection.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
been updated for both.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
(beginning with release 2.1). Node.js can also be installed in Visual Studio Express.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
work on XP. If you are using XP, Artistic Style will need to be recompiled on the XP machine.</p>
|
||||
<p>
|
||||
A new <a href="http://www.visualstudio.com/news/vs2013-community-vs" target="astyle" title="open new window">Visual
|
||||
A new <a href="http://www.visualstudio.com/news/vs2013-community-vs" target="_blank" title="open new window">Visual
|
||||
Studio Community Edition</a> 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
|
||||
<a href="https://visualstudiogallery.msdn.microsoft.com/2f3f04cd-2866-4e47-a671-d1cc9cc3fb02" target="astyle" title="open new window">
|
||||
development environment, and allows the addition of Visual Studio extensions. There is an
|
||||
<a href="https://visualstudiogallery.msdn.microsoft.com/2f3f04cd-2866-4e47-a671-d1cc9cc3fb02" target="_blank" title="open new window">
|
||||
AStyle Extension</a> 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".
|
||||
</p>
|
||||
entry for "astyle".</p>
|
||||
<p>
|
||||
Thanks to Peter A. Bigot, HyungKi Jeong, David Faure, and Carl Moore for their contributions.
|
||||
</p>
|
||||
Thanks to Peter A. Bigot, HyungKi Jeong, David Faure, and Carl Moore for their contributions.</p>
|
||||
|
||||
<h3>Artistic Style 2.04 (November 2013)</h3>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
Style. You may want to format your source before making program changes in order to bring it up to date.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
These new options affect only Objective‑C source code. They have no effect on the other programming
|
||||
languages.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
this value. The default minimum is 40 and the maximum is 120.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
along with a python program to verify the style and an emacs script for using the style.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
indent. The rest of the class is not indented. It is described in the "Indentation Options" section of the
|
||||
documentation.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
of the documentation.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
statement on a single line. It is described in the "Formatting Options" section of the documentation.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
preprocessor #define statements has not changed.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
the indentation of any commented-out code.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
to "pad-first-paren-out". This needs to be done only once.</p>
|
||||
<p>
|
||||
Processing of C++11 raw string literals has been added.
|
||||
</p>
|
||||
Processing of C++11 raw string literals has been added.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
definition from exported functions. Linux compilers do not use this.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
previous release are marked in the example.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
use UTF-16.</p>
|
||||
<p>
|
||||
The "Links" page has two new sections for links mentioned in previous versions of Artistic Style. It links to
|
||||
free software and other information.
|
||||
</p>
|
||||
free software and other information.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
Linux" which has information on compiling and running the example on those systems.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
on Windows XP.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
move semantics will probably result in faster execution.</p>
|
||||
<p>
|
||||
Thanks to Evmenov Georgiy, Matthew Woehlke, Jiang, Ruzzz, and beta100100 for their contributions.
|
||||
</p>
|
||||
Thanks to Evmenov Georgiy, Matthew Woehlke, Jiang, Ruzzz, and beta100100 for their contributions.</p>
|
||||
|
||||
<h3>Artistic Style 2.03 (April 2013)</h3>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
Style. You may want to format your source before making program changes in order to bring it up to date.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
or "xL", will modify a line break for conditionals. See the documentation for details.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
documentation for details.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
than the indent length. See the documentation for details.</p>
|
||||
<p>
|
||||
The short option for delete-empty-lines has changed from "xd" to "xe".
|
||||
</p>
|
||||
The short option for delete-empty-lines has changed from "xd" to "xe".</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
options.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
this before making the changes.</p>
|
||||
<p>
|
||||
The C/C++ keyword 'extern "C"' in a preprocessor no longer causes an extra indent.
|
||||
</p>
|
||||
The C/C++ keyword 'extern "C"' in a preprocessor no longer causes an extra indent.</p>
|
||||
<p>
|
||||
Formatting of C++/CLI managed pointers (the '^' character) has been added to the "align-pointer"
|
||||
option.
|
||||
</p>
|
||||
option.</p>
|
||||
<p>
|
||||
The breaking of switch "default" statements has been fixed. The "default" statements
|
||||
that have been incorrectly broken will be fixed in this release.
|
||||
</p>
|
||||
that have been incorrectly broken will be fixed in this release.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
encoding.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
the addition as a bug report and it will be included in the next release.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
version can be installed on a Windows platform. There is more information in the Install Information
|
||||
documentation.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
option to create the import library and export files.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
on computers using Windows XP.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
files available.</p>
|
||||
<p>
|
||||
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.).
|
||||
</p>
|
||||
execution. (To use C++11 on GCC and MinGW use the option --std=c++0x). This may change on future compiler
|
||||
releases.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
memory in Python.</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
single page scripts. And there are some minor bugs. But overall it works quite well.</p>
|
||||
<p>
|
||||
Thanks to Christopher Sean Morrison, Keith OHara, louis6g, and J for their contributions.
|
||||
</p>
|
||||
Thanks to Christopher Sean Morrison, Keith OHara, louis6g, and J for their contributions.</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Previous releases are available in the <a href="http://astyle.sourceforge.net/newsArchives.html">News Archives</a>.</strong>
|
||||
</p>
|
||||
<strong>Previous releases are available in the
|
||||
<a href="http://astyle.sourceforge.net/newsArchives.html">News Archives</a>.</strong></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</p>
|
||||
|
||||
<center style="margin-left: -0.4in;">
|
||||
<p style="margin-left: -0.4in; text-align: center;">
|
||||
<a href="http://sourceforge.net/projects/astyle">
|
||||
<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2319&type=16" alt="" /></a>
|
||||
</center>
|
||||
<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2319&type=16" alt="" /></a></p>
|
||||
|
||||
<p>
|
||||
|
||||
</p>
|
||||
|
||||
<!-- Piwik -->
|
||||
|
||||
<script type="text/javascript">
|
||||
var pkBaseURL = (("https:" == document.location.protocol) ? "https://sourceforge.net/apps/piwik/astyle/" : "http://sourceforge.net/apps/piwik/astyle/");
|
||||
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
|
||||
piwikTracker.trackPageView();
|
||||
piwikTracker.enableLinkTracking();
|
||||
} catch (err) { }
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<p>
|
||||
<img src="http://sourceforge.net/apps/piwik/astyle/piwik.php?idsite=1" style="border: 0" alt="" />
|
||||
</p>
|
||||
</noscript>
|
||||
|
||||
<!-- End Piwik Tag -->
|
||||
</p>
|
||||
|
||||
</body>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<title>Artistic Style - Release Notes</title>
|
||||
@ -15,8 +15,40 @@
|
||||
<h1>Artistic Style Release Notes</h1>
|
||||
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</p>
|
||||
|
||||
<h3>Artistic Style 2.06 (Pending)</h3>
|
||||
|
||||
<ul>
|
||||
<li>Add new Objective‑C options "pad-return-type" (-xq) and "unpad-return-type" (-xr).</li>
|
||||
<li>Add new option pad-comma (#100).</li>
|
||||
<li>Add removing spaces before a comma (#100).</li>
|
||||
<li>Add formatting of C++14 single-quote digit separators (#337).</li>
|
||||
<li>Add translations for Bulgarian, Estonian, Greek, Hungarian, Norwegian, and Romanian.</li>
|
||||
<li>Remove lineend option from formatCinToCout function, only Windows lineends are allowed.</li>
|
||||
<li>Improve align-method-colon and apply to Objective‑C method calls.</li>
|
||||
<li>Improve recognition of header guards in preprocessor statememts.</li>
|
||||
<li>Improve recognition of C++11 uniform initializer brackets (#381).</li>
|
||||
<li>Change align-method-colon short first line to align on the longest line instead of the first line.</li>
|
||||
<li>Fix not recognizing an escaped space character within a quote (#403).</li>
|
||||
<li>Fix attaching "if" statements to a #else preprocessor directive (#356).</li>
|
||||
<li>Fix not clearing global variables for a new file (#364).</li>
|
||||
<li>Fix not recognizing an rvalue reference in a template (#404).</li>
|
||||
<li>Fix C# to recognize "using" as a header.</li>
|
||||
<li>Fix C# to always recognize "forever" as a header.</li>
|
||||
<li>Fix end of line comments for "pad-method-prefix" and "unpad-method-prefix".</li>
|
||||
<li>Fix end of line comments for "pad-method-colon".</li>
|
||||
<li>Refactoring:
|
||||
<ul>
|
||||
<li>Consolidate scattered ASFormatter conditional statements into a padParenObjC method.</li>
|
||||
<li>Remove ASBase methods from being inlined as class definitions.</li>
|
||||
<li>Replace C char arrays in astyle_main.cpp with C++ strings.</li>
|
||||
<li>Return language translation as a mutable variable.</li>
|
||||
<li>Portability changes for additional compiler support (#352).</li>
|
||||
<li>Minor changes based on results of the Clang-Tidy. </li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Artistic Style 2.05.1 (December 2014)</h3>
|
||||
|
||||
@ -39,7 +71,7 @@
|
||||
<li>Add new option, "dry-run", to run AStyle without updating the files (#184, #285).</li>
|
||||
<li>Add new options, "html" (-!") and "html=###", to display the HTML help documentation in the default browser.
|
||||
</li>
|
||||
<li>Add tags "*INDENT-OFF*" and "*INDENT_ON*" to disable formatting of source code blocks
|
||||
<li>Add tags "*INDENT-OFF*" and "*INDENT_ON*" to disable formatting of source code blocks
|
||||
(#2, #47, #55, #78, #110, #176).</li>
|
||||
<li>Add tag *NOPAD* to disable selected formatting on a single line.</li>
|
||||
<li>Add '__attribute__ ((visibility ("default")))' to Linux exported functions.</li>
|
||||
@ -79,7 +111,7 @@
|
||||
<li>Fix indentation of C# "let" statements.</li>
|
||||
<li>Fix a few omissions with "fill-empty-lines".</li>
|
||||
<li>Fix file read to read 64K blocks of data.</li>
|
||||
<li>Refactor to un-obfuscate (clarify) the code, and improve design and decomposition::
|
||||
<li>Refactor to un-obfuscate (clarify) the code, and improve design and decomposition:
|
||||
<ul>
|
||||
<li>Extract class Utf8_16 from ASConsole. </li>
|
||||
<li>Replace Linux dependency on iconv with a Utf8_16 class for ASLibrary.</li>
|
||||
@ -234,47 +266,19 @@
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Previous releases are available in the <a href="http://astyle.sourceforge.net/notesArchives.html">Release
|
||||
Notes Archives</a>.</strong>
|
||||
</p>
|
||||
Notes Archives</a>.</strong></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</p>
|
||||
|
||||
<center style="margin-left: -0.4in;">
|
||||
<p style="margin-left: -0.4in; text-align: center;">
|
||||
<a href="http://sourceforge.net/projects/astyle">
|
||||
<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2319&type=16" alt="" /></a>
|
||||
</center>
|
||||
<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2319&type=16" alt="" /></a></p>
|
||||
|
||||
<p>
|
||||
|
||||
</p>
|
||||
|
||||
<!-- Piwik -->
|
||||
|
||||
<script type="text/javascript">
|
||||
var pkBaseURL = (("https:" == document.location.protocol) ? "https://sourceforge.net/apps/piwik/astyle/" : "http://sourceforge.net/apps/piwik/astyle/");
|
||||
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
|
||||
piwikTracker.trackPageView();
|
||||
piwikTracker.enableLinkTracking();
|
||||
} catch (err) { }
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<p>
|
||||
<img src="http://sourceforge.net/apps/piwik/astyle/piwik.php?idsite=1" style="border: 0" alt="" />
|
||||
</p>
|
||||
</noscript>
|
||||
|
||||
<!-- End Piwik Tag -->
|
||||
</p>
|
||||
|
||||
</body>
|
||||
|
||||
|
@ -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; }
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,39 +1,29 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* ASBeautifier.cpp
|
||||
*
|
||||
* Copyright (C) 2014 by Jim Pattee
|
||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>
|
||||
*
|
||||
* This file is a part of Artistic Style - an indentation and
|
||||
* reformatting tool for C, C++, C# and Java source files.
|
||||
* <http://astyle.sourceforge.net>
|
||||
*
|
||||
* Artistic Style is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Artistic Style is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Artistic Style. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*/
|
||||
// ASBeautifier.cpp
|
||||
// Copyright (c) 2016 by Jim Pattee <jimp03@email.com>.
|
||||
// This code is licensed under the MIT License.
|
||||
// License.txt describes the conditions under which this software may be distributed.
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// headers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "astyle.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// astyle namespace
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace astyle {
|
||||
|
||||
//
|
||||
// this must be global
|
||||
static int g_preprocessorCppExternCBracket;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ASBeautifier class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* ASBeautifier's constructor
|
||||
* This constructor is called only once for each source file.
|
||||
@ -41,8 +31,6 @@ static int g_preprocessorCppExternCBracket;
|
||||
*/
|
||||
ASBeautifier::ASBeautifier()
|
||||
{
|
||||
g_preprocessorCppExternCBracket = 0;
|
||||
|
||||
waitingBeautifierStack = NULL;
|
||||
activeBeautifierStack = NULL;
|
||||
waitingBeautifierStackLengthStack = NULL;
|
||||
@ -101,7 +89,7 @@ ASBeautifier::ASBeautifier()
|
||||
*
|
||||
* Must explicitly call the base class copy constructor.
|
||||
*/
|
||||
ASBeautifier::ASBeautifier(const ASBeautifier &other) : ASBase(other)
|
||||
ASBeautifier::ASBeautifier(const ASBeautifier& other) : ASBase(other)
|
||||
{
|
||||
// these don't need to copy the stack
|
||||
waitingBeautifierStack = NULL;
|
||||
@ -158,6 +146,7 @@ ASBeautifier::ASBeautifier(const ASBeautifier &other) : ASBase(other)
|
||||
inLineNumber = other.inLineNumber;
|
||||
horstmannIndentInStatement = other.horstmannIndentInStatement;
|
||||
nonInStatementBracket = other.nonInStatementBracket;
|
||||
objCColonAlignSubsequent = other.objCColonAlignSubsequent;
|
||||
lineCommentNoBeautify = other.lineCommentNoBeautify;
|
||||
isElseHeaderIndent = other.isElseHeaderIndent;
|
||||
isCaseHeaderCommentIndent = other.isCaseHeaderCommentIndent;
|
||||
@ -302,6 +291,7 @@ void ASBeautifier::init(ASSourceIterator* iter)
|
||||
sourceIterator = iter;
|
||||
initVectors();
|
||||
ASBase::init(getFileType());
|
||||
g_preprocessorCppExternCBracket = 0;
|
||||
|
||||
initContainer(waitingBeautifierStack, new vector<ASBeautifier*>);
|
||||
initContainer(activeBeautifierStack, new vector<ASBeautifier*>);
|
||||
@ -409,6 +399,7 @@ void ASBeautifier::init(ASSourceIterator* iter)
|
||||
inLineNumber = 0;
|
||||
horstmannIndentInStatement = 0;
|
||||
nonInStatementBracket = 0;
|
||||
objCColonAlignSubsequent = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -736,6 +727,16 @@ bool ASBeautifier::getForceTabIndentation(void) const
|
||||
return shouldForceTabIndentation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the state of the Objective-C align method colon option.
|
||||
*
|
||||
* @return state of shouldAlignMethodColon option.
|
||||
*/
|
||||
bool ASBeautifier::getAlignMethodColon(void) const
|
||||
{
|
||||
return shouldAlignMethodColon;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the state of the block indentation option.
|
||||
*
|
||||
@ -854,10 +855,10 @@ int ASBeautifier::getTabLength(void) const
|
||||
* @return the indented line.
|
||||
* @param originalLine the original unindented line.
|
||||
*/
|
||||
string ASBeautifier::beautify(const string &originalLine)
|
||||
string ASBeautifier::beautify(const string& originalLine)
|
||||
{
|
||||
string line;
|
||||
bool isInQuoteContinuation = isInVerbatimQuote | haveLineContinuationChar;
|
||||
bool isInQuoteContinuation = isInVerbatimQuote || haveLineContinuationChar;
|
||||
|
||||
currentHeader = NULL;
|
||||
lastLineHeader = NULL;
|
||||
@ -965,7 +966,7 @@ string ASBeautifier::beautify(const string &originalLine)
|
||||
{
|
||||
if (isInIndentablePreprocBlock)
|
||||
return preLineWS(preprocBlockIndent, 0);
|
||||
else if (!headerStack->empty() || isInEnum)
|
||||
if (!headerStack->empty() || isInEnum)
|
||||
return preLineWS(prevFinalLineIndentCount, prevFinalLineSpaceIndentCount);
|
||||
// must fall thru here
|
||||
}
|
||||
@ -1075,10 +1076,8 @@ string ASBeautifier::beautify(const string &originalLine)
|
||||
// and then remove it from the active beautifier stack and delete it.
|
||||
if (!backslashEndsPrevLine && isInDefineDefinition && !isInDefine)
|
||||
{
|
||||
ASBeautifier* defineBeautifier;
|
||||
|
||||
isInDefineDefinition = false;
|
||||
defineBeautifier = activeBeautifierStack->back();
|
||||
ASBeautifier* defineBeautifier = activeBeautifierStack->back();
|
||||
activeBeautifierStack->pop_back();
|
||||
|
||||
string indentedLine = defineBeautifier->beautify(line);
|
||||
@ -1099,6 +1098,7 @@ string ASBeautifier::beautify(const string &originalLine)
|
||||
activeBeautifierStack->back()->inLineNumber = inLineNumber;
|
||||
activeBeautifierStack->back()->horstmannIndentInStatement = horstmannIndentInStatement;
|
||||
activeBeautifierStack->back()->nonInStatementBracket = nonInStatementBracket;
|
||||
activeBeautifierStack->back()->objCColonAlignSubsequent = objCColonAlignSubsequent;
|
||||
activeBeautifierStack->back()->lineCommentNoBeautify = lineCommentNoBeautify;
|
||||
activeBeautifierStack->back()->isElseHeaderIndent = isElseHeaderIndent;
|
||||
activeBeautifierStack->back()->isCaseHeaderCommentIndent = isCaseHeaderCommentIndent;
|
||||
@ -1143,6 +1143,9 @@ string ASBeautifier::beautify(const string &originalLine)
|
||||
if (shouldAlignMethodColon)
|
||||
{
|
||||
colonIndentObjCMethodDefinition = line.find(':');
|
||||
int objCColonAlignSubsequentIndent = objCColonAlignSubsequent + indentLength;
|
||||
if (objCColonAlignSubsequentIndent > colonIndentObjCMethodDefinition)
|
||||
colonIndentObjCMethodDefinition = objCColonAlignSubsequentIndent;
|
||||
}
|
||||
else if (inStatementIndentStack->empty()
|
||||
|| inStatementIndentStack->back() == 0)
|
||||
@ -1209,10 +1212,10 @@ string ASBeautifier::beautify(const string &originalLine)
|
||||
return indentedLine;
|
||||
}
|
||||
|
||||
string &ASBeautifier::getIndentedLineReturn(string &newLine, const string &originalLine) const
|
||||
string& ASBeautifier::getIndentedLineReturn(string& newLine, const string& originalLine) const
|
||||
{
|
||||
if (isIndentModeOff)
|
||||
return const_cast<string &>(originalLine);
|
||||
return const_cast<string&>(originalLine);
|
||||
return newLine;
|
||||
}
|
||||
|
||||
@ -1246,10 +1249,9 @@ string ASBeautifier::preLineWS(int lineIndentCount, int lineSpaceIndentCount) co
|
||||
/**
|
||||
* register an in-statement indent.
|
||||
*/
|
||||
void ASBeautifier::registerInStatementIndent(const string &line, int i, int spaceTabCount_,
|
||||
void ASBeautifier::registerInStatementIndent(const string& line, int i, int spaceTabCount_,
|
||||
int tabIncrementIn, int minIndent, bool updateParenStack)
|
||||
{
|
||||
int inStatementIndent;
|
||||
int remainingCharNum = line.length() - i;
|
||||
int nextNonWSChar = getNextProgramCharDistance(line, i);
|
||||
|
||||
@ -1281,7 +1283,7 @@ void ASBeautifier::registerInStatementIndent(const string &line, int i, int spac
|
||||
tabIncrement += convertTabToSpaces(j, tabIncrement);
|
||||
}
|
||||
|
||||
inStatementIndent = i + nextNonWSChar + spaceTabCount_ + tabIncrement;
|
||||
int inStatementIndent = i + nextNonWSChar + spaceTabCount_ + tabIncrement;
|
||||
|
||||
// check for run-in statement
|
||||
if (i > 0 && line[0] == '{')
|
||||
@ -1309,7 +1311,7 @@ void ASBeautifier::registerInStatementIndent(const string &line, int i, int spac
|
||||
/**
|
||||
* Register an in-statement indent for a class header or a class initializer colon.
|
||||
*/
|
||||
void ASBeautifier::registerInStatementIndentColon(const string &line, int i, int tabIncrementIn)
|
||||
void ASBeautifier::registerInStatementIndentColon(const string& line, int i, int tabIncrementIn)
|
||||
{
|
||||
assert(line[i] == ':');
|
||||
assert(isInClassInitializer || isInClassHeaderTab);
|
||||
@ -1351,7 +1353,7 @@ pair<int, int> ASBeautifier::computePreprocessorIndent()
|
||||
* get distance to the next non-white space, non-comment character in the line.
|
||||
* if no such character exists, return the length remaining to the end of the line.
|
||||
*/
|
||||
int ASBeautifier::getNextProgramCharDistance(const string &line, int i) const
|
||||
int ASBeautifier::getNextProgramCharDistance(const string& line, int i) const
|
||||
{
|
||||
bool inComment = false;
|
||||
int remainingCharNum = line.length() - i;
|
||||
@ -1376,7 +1378,7 @@ int ASBeautifier::getNextProgramCharDistance(const string &line, int i) const
|
||||
{
|
||||
if (line.compare(i + charDistance, 2, "//") == 0)
|
||||
return remainingCharNum;
|
||||
else if (line.compare(i + charDistance, 2, "/*") == 0)
|
||||
if (line.compare(i + charDistance, 2, "/*") == 0)
|
||||
{
|
||||
charDistance++;
|
||||
inComment = true;
|
||||
@ -1390,7 +1392,7 @@ int ASBeautifier::getNextProgramCharDistance(const string &line, int i) const
|
||||
}
|
||||
|
||||
// check if a specific line position contains a header.
|
||||
const string* ASBeautifier::findHeader(const string &line, int i,
|
||||
const string* ASBeautifier::findHeader(const string& line, int i,
|
||||
const vector<const string*>* possibleHeaders) const
|
||||
{
|
||||
assert(isCharPotentialHeader(line, i));
|
||||
@ -1428,7 +1430,7 @@ const string* ASBeautifier::findHeader(const string &line, int i,
|
||||
}
|
||||
|
||||
// check if a specific line position contains an operator.
|
||||
const string* ASBeautifier::findOperator(const string &line, int i,
|
||||
const string* ASBeautifier::findOperator(const string& line, int i,
|
||||
const vector<const string*>* possibleOperators) const
|
||||
{
|
||||
assert(isCharPotentialOperator(line[i]));
|
||||
@ -1454,15 +1456,14 @@ const string* ASBeautifier::findOperator(const string &line, int i,
|
||||
* @param container a vector of strings.
|
||||
* @param element the element to find .
|
||||
*/
|
||||
int ASBeautifier::indexOf(vector<const string*> &container, const string* element) const
|
||||
int ASBeautifier::indexOf(vector<const string*>& container, const string* element) const
|
||||
{
|
||||
vector<const string*>::const_iterator where;
|
||||
|
||||
where = find(container.begin(), container.end(), element);
|
||||
if (where == container.end())
|
||||
return -1;
|
||||
else
|
||||
return (int) (where - container.begin());
|
||||
return (int) (where - container.begin());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1483,9 +1484,8 @@ int ASBeautifier::convertTabToSpaces(int i, int tabIncrementIn) const
|
||||
* @return the trimmed line.
|
||||
* @param str the line to trim.
|
||||
*/
|
||||
string ASBeautifier::trim(const string &str) const
|
||||
string ASBeautifier::trim(const string& str) const
|
||||
{
|
||||
|
||||
int start = 0;
|
||||
int end = str.length() - 1;
|
||||
|
||||
@ -1509,7 +1509,7 @@ string ASBeautifier::trim(const string &str) const
|
||||
* @return the trimmed line.
|
||||
* @param str the line to trim.
|
||||
*/
|
||||
string ASBeautifier::rtrim(const string &str) const
|
||||
string ASBeautifier::rtrim(const string& str) const
|
||||
{
|
||||
size_t len = str.length();
|
||||
size_t end = str.find_last_not_of(" \t");
|
||||
@ -1524,7 +1524,7 @@ string ASBeautifier::rtrim(const string &str) const
|
||||
* Copy tempStacks for the copy constructor.
|
||||
* The value of the vectors must also be copied.
|
||||
*/
|
||||
vector<vector<const string*>*>* ASBeautifier::copyTempStacks(const ASBeautifier &other) const
|
||||
vector<vector<const string*>*>* ASBeautifier::copyTempStacks(const ASBeautifier& other) const
|
||||
{
|
||||
vector<vector<const string*>*>* tempStacksNew = new vector<vector<const string*>*>;
|
||||
vector<vector<const string*>*>::iterator iter;
|
||||
@ -1560,7 +1560,7 @@ void ASBeautifier::deleteBeautifierVectors()
|
||||
* used for all vectors except tempStacks
|
||||
*/
|
||||
template<typename T>
|
||||
void ASBeautifier::deleteContainer(T &container)
|
||||
void ASBeautifier::deleteContainer(T& container)
|
||||
{
|
||||
if (container != NULL)
|
||||
{
|
||||
@ -1576,7 +1576,7 @@ void ASBeautifier::deleteContainer(T &container)
|
||||
* Therefore the ASBeautifier objects have to be deleted in addition to the
|
||||
* ASBeautifier pointer entries.
|
||||
*/
|
||||
void ASBeautifier::deleteBeautifierContainer(vector<ASBeautifier*>* &container)
|
||||
void ASBeautifier::deleteBeautifierContainer(vector<ASBeautifier*>*& container)
|
||||
{
|
||||
if (container != NULL)
|
||||
{
|
||||
@ -1597,7 +1597,7 @@ void ASBeautifier::deleteBeautifierContainer(vector<ASBeautifier*>* &container)
|
||||
* The tempStacks is a vector of pointers to strings allocated with the 'new' operator.
|
||||
* Therefore the strings have to be deleted in addition to the tempStacks entries.
|
||||
*/
|
||||
void ASBeautifier::deleteTempStacksContainer(vector<vector<const string*>*>* &container)
|
||||
void ASBeautifier::deleteTempStacksContainer(vector<vector<const string*>*>*& container)
|
||||
{
|
||||
if (container != NULL)
|
||||
{
|
||||
@ -1618,7 +1618,7 @@ void ASBeautifier::deleteTempStacksContainer(vector<vector<const string*>*>* &co
|
||||
* T is the type of vector used for all vectors
|
||||
*/
|
||||
template<typename T>
|
||||
void ASBeautifier::initContainer(T &container, T value)
|
||||
void ASBeautifier::initContainer(T& container, T value)
|
||||
{
|
||||
// since the ASFormatter object is never deleted,
|
||||
// the existing vectors must be deleted before creating new ones
|
||||
@ -1632,7 +1632,7 @@ void ASBeautifier::initContainer(T &container, T value)
|
||||
* The tempStacks is a vector of pointers to strings allocated with the 'new' operator.
|
||||
* Any residual entries are deleted before the vector is initialized.
|
||||
*/
|
||||
void ASBeautifier::initTempStacksContainer(vector<vector<const string*>*>* &container,
|
||||
void ASBeautifier::initTempStacksContainer(vector<vector<const string*>*>*& container,
|
||||
vector<vector<const string*>*>* value)
|
||||
{
|
||||
if (container != NULL)
|
||||
@ -1647,7 +1647,7 @@ void ASBeautifier::initTempStacksContainer(vector<vector<const string*>*>* &cont
|
||||
*
|
||||
* @return true if line ends with a comma, otherwise false.
|
||||
*/
|
||||
bool ASBeautifier::statementEndsWithComma(const string &line, int index) const
|
||||
bool ASBeautifier::statementEndsWithComma(const string& line, int index) const
|
||||
{
|
||||
assert(line[index] == '=');
|
||||
|
||||
@ -1685,7 +1685,8 @@ bool ASBeautifier::statementEndsWithComma(const string &line, int index) const
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == '"' || ch == '\'')
|
||||
if (ch == '"'
|
||||
|| (ch == '\'' && !isDigitSeparator(line, i)))
|
||||
{
|
||||
isInQuote_ = true;
|
||||
quoteChar_ = ch;
|
||||
@ -1730,7 +1731,7 @@ bool ASBeautifier::statementEndsWithComma(const string &line, int index) const
|
||||
*
|
||||
* @return is before a line-end comment.
|
||||
*/
|
||||
bool ASBeautifier::isLineEndComment(const string &line, int startPos) const
|
||||
bool ASBeautifier::isLineEndComment(const string& line, int startPos) const
|
||||
{
|
||||
assert(line.compare(startPos, 2, "/*") == 0);
|
||||
|
||||
@ -1750,7 +1751,7 @@ bool ASBeautifier::isLineEndComment(const string &line, int startPos) const
|
||||
*
|
||||
* @return is the index to the previous word (the in statement indent).
|
||||
*/
|
||||
int ASBeautifier::getInStatementIndentAssign(const string &line, size_t currPos) const
|
||||
int ASBeautifier::getInStatementIndentAssign(const string& line, size_t currPos) const
|
||||
{
|
||||
assert(line[currPos] == '=');
|
||||
|
||||
@ -1778,7 +1779,7 @@ int ASBeautifier::getInStatementIndentAssign(const string &line, size_t currPos)
|
||||
*
|
||||
* @return is the indent to the second word on the line (the in statement indent).
|
||||
*/
|
||||
int ASBeautifier::getInStatementIndentComma(const string &line, size_t currPos) const
|
||||
int ASBeautifier::getInStatementIndentComma(const string& line, size_t currPos) const
|
||||
{
|
||||
assert(line[currPos] == ',');
|
||||
|
||||
@ -1811,7 +1812,7 @@ int ASBeautifier::getInStatementIndentComma(const string &line, size_t currPos)
|
||||
*
|
||||
* @return is the next word or an empty string if none found.
|
||||
*/
|
||||
string ASBeautifier::getNextWord(const string &line, size_t currPos) const
|
||||
string ASBeautifier::getNextWord(const string& line, size_t currPos) const
|
||||
{
|
||||
size_t lineLength = line.length();
|
||||
// get the last legal word (may be a number)
|
||||
@ -1839,7 +1840,7 @@ string ASBeautifier::getNextWord(const string &line, size_t currPos) const
|
||||
*
|
||||
* @return is true or false.
|
||||
*/
|
||||
bool ASBeautifier::isIndentedPreprocessor(const string &line, size_t currPos) const
|
||||
bool ASBeautifier::isIndentedPreprocessor(const string& line, size_t currPos) const
|
||||
{
|
||||
assert(line[0] == '#');
|
||||
string nextWord = getNextWord(line, currPos);
|
||||
@ -1885,7 +1886,7 @@ bool ASBeautifier::isIndentedPreprocessor(const string &line, size_t currPos) co
|
||||
*
|
||||
* @return is true or false.
|
||||
*/
|
||||
bool ASBeautifier::isPreprocessorConditionalCplusplus(const string &line) const
|
||||
bool ASBeautifier::isPreprocessorConditionalCplusplus(const string& line) const
|
||||
{
|
||||
string preproc = trim(line.substr(1));
|
||||
if (preproc.compare(0, 5, "ifdef") == 0 && getNextWord(preproc, 4) == "__cplusplus")
|
||||
@ -1917,7 +1918,7 @@ bool ASBeautifier::isPreprocessorConditionalCplusplus(const string &line) const
|
||||
*
|
||||
* @return is true or false.
|
||||
*/
|
||||
bool ASBeautifier::isInPreprocessorUnterminatedComment(const string &line)
|
||||
bool ASBeautifier::isInPreprocessorUnterminatedComment(const string& line)
|
||||
{
|
||||
if (!isInPreprocessorComment)
|
||||
{
|
||||
@ -1952,7 +1953,7 @@ int ASBeautifier::getBeautifierFileType() const
|
||||
/**
|
||||
* Process preprocessor statements and update the beautifier stacks.
|
||||
*/
|
||||
void ASBeautifier::processPreprocessor(const string &preproc, const string &line)
|
||||
void ASBeautifier::processPreprocessor(const string& preproc, const string& line)
|
||||
{
|
||||
// When finding a multi-lined #define statement, the original beautifier
|
||||
// 1. sets its isInDefineDefinition flag
|
||||
@ -1965,14 +1966,12 @@ void ASBeautifier::processPreprocessor(const string &preproc, const string &line
|
||||
{
|
||||
if (!isInDefineDefinition)
|
||||
{
|
||||
ASBeautifier* defineBeautifier;
|
||||
|
||||
// this is the original beautifier
|
||||
isInDefineDefinition = true;
|
||||
|
||||
// push a new beautifier into the active stack
|
||||
// this beautifier will be used for the indentation of this define
|
||||
defineBeautifier = new ASBeautifier(*this);
|
||||
ASBeautifier* defineBeautifier = new ASBeautifier(*this);
|
||||
activeBeautifierStack->push_back(defineBeautifier);
|
||||
}
|
||||
else
|
||||
@ -2012,8 +2011,8 @@ void ASBeautifier::processPreprocessor(const string &preproc, const string &line
|
||||
}
|
||||
else if (preproc == "endif")
|
||||
{
|
||||
int stackLength;
|
||||
ASBeautifier* beautifier;
|
||||
int stackLength = 0;
|
||||
ASBeautifier* beautifier = NULL;
|
||||
|
||||
if (waitingBeautifierStackLengthStack != NULL && !waitingBeautifierStackLengthStack->empty())
|
||||
{
|
||||
@ -2145,7 +2144,7 @@ void ASBeautifier::computePreliminaryIndentation()
|
||||
&& (*headerStack)[headerStack->size() - 2] == &AS_CLASS
|
||||
&& (*headerStack)[headerStack->size() - 1] == &AS_OPEN_BRACKET
|
||||
&& lineBeginsWithCloseBracket
|
||||
&& bracketBlockStateStack->back() == true)
|
||||
&& bracketBlockStateStack->back())
|
||||
--indentCount;
|
||||
|
||||
// unindent an indented switch closing bracket...
|
||||
@ -2283,7 +2282,7 @@ int ASBeautifier::adjustIndentCountForBreakElseIfComments() const
|
||||
* Extract a preprocessor statement without the #.
|
||||
* If a error occurs an empty string is returned.
|
||||
*/
|
||||
string ASBeautifier::extractPreprocessorStatement(const string &line) const
|
||||
string ASBeautifier::extractPreprocessorStatement(const string& line) const
|
||||
{
|
||||
string preproc;
|
||||
size_t start = line.find_first_not_of("#/ \t");
|
||||
@ -2305,6 +2304,7 @@ void ASBeautifier::clearObjCMethodDefinitionAlignment()
|
||||
spaceIndentCount = 0;
|
||||
spaceIndentObjCMethodDefinition = 0;
|
||||
colonIndentObjCMethodDefinition = 0;
|
||||
objCColonAlignSubsequent = 0;
|
||||
isInObjCMethodDefinition = false;
|
||||
isImmediatelyPostObjCMethodDefinition = false;
|
||||
if (!inStatementIndentStack->empty())
|
||||
@ -2317,7 +2317,7 @@ void ASBeautifier::clearObjCMethodDefinitionAlignment()
|
||||
* If it cannot be aligned indentLength is returned and a new colon
|
||||
* position is calculated.
|
||||
*/
|
||||
int ASBeautifier::computeObjCColonAlignment(string &line, int colonAlignPosition) const
|
||||
int ASBeautifier::computeObjCColonAlignment(string& line, int colonAlignPosition) const
|
||||
{
|
||||
int colonPosition = line.find(':');
|
||||
if (colonPosition < 0 || colonPosition > colonAlignPosition)
|
||||
@ -2328,7 +2328,7 @@ int ASBeautifier::computeObjCColonAlignment(string &line, int colonAlignPosition
|
||||
/**
|
||||
* Parse the current line to update indentCount and spaceIndentCount.
|
||||
*/
|
||||
void ASBeautifier::parseCurrentLine(const string &line)
|
||||
void ASBeautifier::parseCurrentLine(const string& line)
|
||||
{
|
||||
bool isInLineComment = false;
|
||||
bool isInOperator = false;
|
||||
@ -2347,15 +2347,7 @@ void ASBeautifier::parseCurrentLine(const string &line)
|
||||
if (isInBeautifySQL)
|
||||
continue;
|
||||
|
||||
if (isWhiteSpace(ch))
|
||||
{
|
||||
if (ch == '\t')
|
||||
tabIncrementIn += convertTabToSpaces(i, tabIncrementIn);
|
||||
continue;
|
||||
}
|
||||
|
||||
// handle special characters (i.e. backslash+character such as \n, \t, ...)
|
||||
|
||||
if (isInQuote && !isInVerbatimQuote)
|
||||
{
|
||||
if (isSpecialChar)
|
||||
@ -2380,8 +2372,18 @@ void ASBeautifier::parseCurrentLine(const string &line)
|
||||
else if (isInDefine && ch == '\\')
|
||||
continue;
|
||||
|
||||
// bypass whitespace here
|
||||
if (isWhiteSpace(ch))
|
||||
{
|
||||
if (ch == '\t')
|
||||
tabIncrementIn += convertTabToSpaces(i, tabIncrementIn);
|
||||
continue;
|
||||
}
|
||||
|
||||
// handle quotes (such as 'x' and "Hello Dolly")
|
||||
if (!(isInComment || isInLineComment) && (ch == '"' || ch == '\''))
|
||||
if (!(isInComment || isInLineComment)
|
||||
&& (ch == '"'
|
||||
|| (ch == '\'' && !isDigitSeparator(line, i))))
|
||||
{
|
||||
if (!isInQuote)
|
||||
{
|
||||
@ -2807,11 +2809,15 @@ void ASBeautifier::parseCurrentLine(const string &line)
|
||||
const string* newHeader = findHeader(line, i, headers);
|
||||
|
||||
// Qt headers may be variables in C++
|
||||
if (newHeader == &AS_FOREVER || newHeader == &AS_FOREACH)
|
||||
if (isCStyle()
|
||||
&& (newHeader == &AS_FOREVER || newHeader == &AS_FOREACH))
|
||||
{
|
||||
if (line.find_first_of("=;", i) != string::npos)
|
||||
newHeader = NULL;
|
||||
}
|
||||
else if (newHeader == &AS_USING
|
||||
&& ASBeautifier::peekNextChar(line, i + (*newHeader).length() - 1) != '(')
|
||||
newHeader = NULL;
|
||||
|
||||
if (newHeader != NULL)
|
||||
{
|
||||
@ -2820,10 +2826,8 @@ void ASBeautifier::parseCurrentLine(const string &line)
|
||||
|
||||
isInHeader = true;
|
||||
|
||||
vector<const string*>* lastTempStack;
|
||||
if (tempStacks->empty())
|
||||
lastTempStack = NULL;
|
||||
else
|
||||
vector<const string*>* lastTempStack = NULL;;
|
||||
if (!tempStacks->empty())
|
||||
lastTempStack = tempStacks->back();
|
||||
|
||||
// if a new block is opened, push a new stack into tempStacks to hold the
|
||||
@ -3027,8 +3031,7 @@ void ASBeautifier::parseCurrentLine(const string &line)
|
||||
}
|
||||
else if (isDigit(peekNextChar(line, i)))
|
||||
{
|
||||
// found a bit field
|
||||
// so do nothing special
|
||||
// found a bit field - do nothing special
|
||||
}
|
||||
else if (isCStyle() && isInClass && prevNonSpaceCh != ')')
|
||||
{
|
||||
@ -3477,5 +3480,4 @@ void ASBeautifier::parseCurrentLine(const string &line)
|
||||
} // end of for loop * end of for loop * end of for loop * end of for loop * end of for loop *
|
||||
}
|
||||
|
||||
|
||||
} // end namespace astyle
|
||||
|
@ -1,33 +1,23 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* ASEnhancer.cpp
|
||||
*
|
||||
* Copyright (C) 2014 by Jim Pattee
|
||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>
|
||||
*
|
||||
* This file is a part of Artistic Style - an indentation and
|
||||
* reformatting tool for C, C++, C# and Java source files.
|
||||
* <http://astyle.sourceforge.net>
|
||||
*
|
||||
* Artistic Style is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Artistic Style is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Artistic Style. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*/
|
||||
// ASEnhancer.cpp
|
||||
// Copyright (c) 2016 by Jim Pattee <jimp03@email.com>.
|
||||
// This code is licensed under the MIT License.
|
||||
// License.txt describes the conditions under which this software may be distributed.
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// headers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "astyle.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// astyle namespace
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace astyle {
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// ASEnhancer class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* ASEnhancer constructor
|
||||
@ -108,7 +98,7 @@ void ASEnhancer::init(int _fileType,
|
||||
*
|
||||
* @param line the original formatted line will be updated if necessary.
|
||||
*/
|
||||
void ASEnhancer::enhance(string &line, bool isInNamespace, bool isInPreprocessor, bool isInSQL)
|
||||
void ASEnhancer::enhance(string& line, bool isInNamespace, bool isInPreprocessor, bool isInSQL)
|
||||
{
|
||||
shouldUnindentLine = true;
|
||||
shouldUnindentComment = false;
|
||||
@ -174,7 +164,7 @@ void ASEnhancer::enhance(string &line, bool isInNamespace, bool isInPreprocessor
|
||||
*
|
||||
* @param line a reference to the line that will be converted.
|
||||
*/
|
||||
void ASEnhancer::convertForceTabIndentToSpaces(string &line) const
|
||||
void ASEnhancer::convertForceTabIndentToSpaces(string& line) const
|
||||
{
|
||||
// replace tab indents with spaces
|
||||
for (size_t i = 0; i < line.length(); i++)
|
||||
@ -195,15 +185,14 @@ void ASEnhancer::convertForceTabIndentToSpaces(string &line) const
|
||||
*
|
||||
* @param line a reference to the line that will be converted.
|
||||
*/
|
||||
void ASEnhancer::convertSpaceIndentToForceTab(string &line) const
|
||||
void ASEnhancer::convertSpaceIndentToForceTab(string& line) const
|
||||
{
|
||||
assert(tabLength > 0);
|
||||
|
||||
// replace leading spaces with tab indents
|
||||
size_t newSpaceIndentLength = line.find_first_not_of(" \t");
|
||||
size_t tabCount = newSpaceIndentLength / tabLength; // truncate extra spaces
|
||||
line.erase(0U, tabCount * tabLength);
|
||||
line.insert(0U, tabCount, '\t');
|
||||
line.replace(0U, tabCount * tabLength, tabCount, '\t');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -213,7 +202,7 @@ void ASEnhancer::convertSpaceIndentToForceTab(string &line) const
|
||||
* @param caseIndex the line index of the case statement.
|
||||
* @return the line index of the colon.
|
||||
*/
|
||||
size_t ASEnhancer::findCaseColon(string &line, size_t caseIndex) const
|
||||
size_t ASEnhancer::findCaseColon(string& line, size_t caseIndex) const
|
||||
{
|
||||
size_t i = caseIndex;
|
||||
bool isInQuote_ = false;
|
||||
@ -238,7 +227,8 @@ size_t ASEnhancer::findCaseColon(string &line, size_t caseIndex) const
|
||||
continue; // must close quote before continuing
|
||||
}
|
||||
}
|
||||
if (line[i] == '\'' || line[i] == '\"') // check opening quote
|
||||
if (line[i] == '"' // check opening quote
|
||||
|| (line[i] == '\'' && !isDigitSeparator(line, i)))
|
||||
{
|
||||
isInQuote_ = true;
|
||||
quoteChar_ = line[i];
|
||||
@ -263,13 +253,13 @@ size_t ASEnhancer::findCaseColon(string &line, size_t caseIndex) const
|
||||
* @param indent the number of tabsets to insert.
|
||||
* @return the number of characters inserted.
|
||||
*/
|
||||
int ASEnhancer::indentLine(string &line, int indent) const
|
||||
int ASEnhancer::indentLine(string& line, int indent) const
|
||||
{
|
||||
if (line.length() == 0
|
||||
&& !emptyLineFill)
|
||||
return 0;
|
||||
|
||||
size_t charsToInsert;
|
||||
size_t charsToInsert = 0;
|
||||
|
||||
if (forceTab && indentLength != tabLength)
|
||||
{
|
||||
@ -277,19 +267,19 @@ int ASEnhancer::indentLine(string &line, int indent) const
|
||||
convertForceTabIndentToSpaces(line);
|
||||
// insert the space indents
|
||||
charsToInsert = indent * indentLength;
|
||||
line.insert(0U, charsToInsert, ' ');
|
||||
line.insert(line.begin(), charsToInsert, ' ');
|
||||
// replace leading spaces with tab indents
|
||||
convertSpaceIndentToForceTab(line);
|
||||
}
|
||||
else if (useTabs)
|
||||
{
|
||||
charsToInsert = indent;
|
||||
line.insert(0U, charsToInsert, '\t');
|
||||
line.insert(line.begin(), charsToInsert, '\t');
|
||||
}
|
||||
else // spaces
|
||||
{
|
||||
charsToInsert = indent * indentLength;
|
||||
line.insert(0U, charsToInsert, ' ');
|
||||
line.insert(line.begin(), charsToInsert, ' ');
|
||||
}
|
||||
|
||||
return charsToInsert;
|
||||
@ -303,7 +293,7 @@ int ASEnhancer::indentLine(string &line, int indent) const
|
||||
* @param index the current line index.
|
||||
* @return true if a hit.
|
||||
*/
|
||||
bool ASEnhancer::isBeginDeclareSectionSQL(string &line, size_t index) const
|
||||
bool ASEnhancer::isBeginDeclareSectionSQL(string& line, size_t index) const
|
||||
{
|
||||
string word;
|
||||
size_t hits = 0;
|
||||
@ -352,7 +342,7 @@ bool ASEnhancer::isBeginDeclareSectionSQL(string &line, size_t index) const
|
||||
* @param index the current line index.
|
||||
* @return true if a hit.
|
||||
*/
|
||||
bool ASEnhancer::isEndDeclareSectionSQL(string &line, size_t index) const
|
||||
bool ASEnhancer::isEndDeclareSectionSQL(string& line, size_t index) const
|
||||
{
|
||||
string word;
|
||||
size_t hits = 0;
|
||||
@ -401,7 +391,7 @@ bool ASEnhancer::isEndDeclareSectionSQL(string &line, size_t index) const
|
||||
* @return false = one-line bracket has not been reached.
|
||||
* true = one-line bracket has been reached.
|
||||
*/
|
||||
bool ASEnhancer::isOneLineBlockReached(string &line, int startChar) const
|
||||
bool ASEnhancer::isOneLineBlockReached(string& line, int startChar) const
|
||||
{
|
||||
assert(line[startChar] == '{');
|
||||
|
||||
@ -439,7 +429,8 @@ bool ASEnhancer::isOneLineBlockReached(string &line, int startChar) const
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == '"' || ch == '\'')
|
||||
if (ch == '"'
|
||||
|| (ch == '\'' && !isDigitSeparator(line, i)))
|
||||
{
|
||||
isInQuote_ = true;
|
||||
quoteChar_ = ch;
|
||||
@ -472,7 +463,7 @@ bool ASEnhancer::isOneLineBlockReached(string &line, int startChar) const
|
||||
* parse characters in the current line to determine if an indent
|
||||
* or unindent is needed.
|
||||
*/
|
||||
void ASEnhancer::parseCurrentLine(string &line, bool isInPreprocessor, bool isInSQL)
|
||||
void ASEnhancer::parseCurrentLine(string& line, bool isInPreprocessor, bool isInSQL)
|
||||
{
|
||||
bool isSpecialChar = false; // is a backslash escape character
|
||||
|
||||
@ -502,7 +493,9 @@ void ASEnhancer::parseCurrentLine(string &line, bool isInPreprocessor, bool isIn
|
||||
}
|
||||
|
||||
// handle quotes (such as 'x' and "Hello Dolly")
|
||||
if (!isInComment && (ch == '"' || ch == '\''))
|
||||
if (!isInComment
|
||||
&& (ch == '"'
|
||||
|| (ch == '\'' && !isDigitSeparator(line, i))))
|
||||
{
|
||||
if (!isInQuote)
|
||||
{
|
||||
@ -665,7 +658,7 @@ void ASEnhancer::parseCurrentLine(string &line, bool isInPreprocessor, bool isIn
|
||||
* @param index the current line index.
|
||||
* @return the new line index.
|
||||
*/
|
||||
size_t ASEnhancer::processSwitchBlock(string &line, size_t index)
|
||||
size_t ASEnhancer::processSwitchBlock(string& line, size_t index)
|
||||
{
|
||||
size_t i = index;
|
||||
bool isPotentialKeyword = isCharPotentialHeader(line, i);
|
||||
@ -754,7 +747,7 @@ size_t ASEnhancer::processSwitchBlock(string &line, size_t index)
|
||||
* @param unindent the number of tabsets to erase.
|
||||
* @return the number of characters erased.
|
||||
*/
|
||||
int ASEnhancer::unindentLine(string &line, int unindent) const
|
||||
int ASEnhancer::unindentLine(string& line, int unindent) const
|
||||
{
|
||||
size_t whitespace = line.find_first_not_of(" \t");
|
||||
|
||||
@ -800,5 +793,4 @@ int ASEnhancer::unindentLine(string &line, int unindent) const
|
||||
return charsToErase;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace astyle
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,38 +1,34 @@
|
||||
// ASLocalizer.cpp
|
||||
// Copyright (c) 2016 by Jim Pattee <jimp03@email.com>.
|
||||
// This code is licensed under the MIT License.
|
||||
// License.txt describes the conditions under which this software may be distributed.
|
||||
//
|
||||
// FILE ENCODING IS UTF-8 WITHOUT A BOM.
|
||||
// русский 中文(简体) 日本 한국의
|
||||
// File encoding for this file is UTF-8 WITHOUT a byte order mark(BOM).
|
||||
// русский 中文(简体) 日本語 한국의
|
||||
//
|
||||
// Windows:
|
||||
// Add the required "Language" to the system.
|
||||
// The settings do NOT need to be changed to the added language.
|
||||
// Change the "Region" settings.
|
||||
// Change both the "Format" and the "Current Language..." settings.
|
||||
// A restart is required if the codepage has changed.
|
||||
// Windows problems:
|
||||
// Hindi -no available locale, language pack removed
|
||||
// Japanese - language pack install error
|
||||
// Ukranian - displays a ? instead of i
|
||||
//
|
||||
// Linux:
|
||||
// Change the LANG environment variable: LANG=fr_FR.UTF-8.
|
||||
// setlocale() will use the LANG environment variable on Linux.
|
||||
//
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* ASLocalizer.cpp
|
||||
*
|
||||
* Copyright (C) 2014 by Jim Pattee
|
||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>
|
||||
*
|
||||
* This file is a part of Artistic Style - an indentation and
|
||||
* reformatting tool for C, C++, C# and Java source files.
|
||||
* <http://astyle.sourceforge.net>
|
||||
*
|
||||
* Artistic Style is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Artistic Style is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Artistic Style. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* To add a new language:
|
||||
* To add a new language to this source module:
|
||||
*
|
||||
* Add a new translation class to ASLocalizer.h.
|
||||
* Add the Add the English-Translation pair to the constructor in ASLocalizer.cpp.
|
||||
* Update the WinLangCode array, if necessary.
|
||||
* Add the language code to the function setTranslationClass().
|
||||
* Update the WinLangCode array in ASLocalizer.cpp.
|
||||
* Add the language code to setTranslationClass() in ASLocalizer.cpp.
|
||||
* Add the English-Translation pair to the constructor in ASLocalizer.cpp.
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*/
|
||||
@ -48,7 +44,6 @@
|
||||
#endif
|
||||
|
||||
#ifdef __DMC__
|
||||
#include <locale.h>
|
||||
// digital mars doesn't have these
|
||||
const size_t SUBLANG_CHINESE_MACAU = 5;
|
||||
const size_t LANG_HINDI = 57;
|
||||
@ -63,12 +58,12 @@
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <locale.h> // needed by some compilers
|
||||
#include <stdlib.h>
|
||||
#include <typeinfo>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4996) // secure version deprecation warnings
|
||||
// #pragma warning(disable: 4267) // 64 bit signed/unsigned loss of data
|
||||
#endif
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
@ -80,6 +75,10 @@
|
||||
#pragma warning(disable: 981) // operands are evaluated in unspecified order
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" // wcstombs
|
||||
#endif
|
||||
|
||||
namespace astyle {
|
||||
|
||||
#ifndef ASTYLE_LIB
|
||||
@ -100,10 +99,6 @@ ASLocalizer::ASLocalizer()
|
||||
m_translation = NULL;
|
||||
|
||||
// Not all compilers support the C++ function locale::global(locale(""));
|
||||
// For testing on Windows change the "Region and Language" settings or use AppLocale.
|
||||
// For testing on Linux change the LANG environment variable: LANG=fr_FR.UTF-8.
|
||||
// setlocale() will use the LANG environment variable on Linux.
|
||||
|
||||
char* localeName = setlocale(LC_ALL, "");
|
||||
if (localeName == NULL) // use the english (ascii) defaults
|
||||
{
|
||||
@ -139,22 +134,28 @@ static WinLangCode wlc[] =
|
||||
// sublanguage identifier http://msdn.microsoft.com/en-us/library/aa913256.aspx
|
||||
// language ID http://msdn.microsoft.com/en-us/library/ee797784%28v=cs.20%29.aspx
|
||||
{
|
||||
{ LANG_CHINESE, "zh" },
|
||||
{ LANG_DUTCH, "nl" },
|
||||
{ LANG_ENGLISH, "en" },
|
||||
{ LANG_FINNISH, "fi" },
|
||||
{ LANG_FRENCH, "fr" },
|
||||
{ LANG_GERMAN, "de" },
|
||||
{ LANG_HINDI, "hi" },
|
||||
{ LANG_ITALIAN, "it" },
|
||||
{ LANG_JAPANESE, "ja" },
|
||||
{ LANG_KOREAN, "ko" },
|
||||
{ LANG_POLISH, "pl" },
|
||||
{ LANG_PORTUGUESE, "pt" },
|
||||
{ LANG_RUSSIAN, "ru" },
|
||||
{ LANG_SPANISH, "es" },
|
||||
{ LANG_SWEDISH, "sv" },
|
||||
{ LANG_UKRAINIAN, "uk" },
|
||||
{ LANG_BULGARIAN, "bg" }, // bg-BG 1251
|
||||
{ LANG_CHINESE, "zh" }, // zh-CHS, zh-CHT
|
||||
{ LANG_DUTCH, "nl" }, // nl-NL 1252
|
||||
{ LANG_ENGLISH, "en" }, // en-US 1252
|
||||
{ LANG_ESTONIAN, "et" }, // et-EE
|
||||
{ LANG_FINNISH, "fi" }, // fi-FI 1252
|
||||
{ LANG_FRENCH, "fr" }, // fr-FR 1252
|
||||
{ LANG_GERMAN, "de" }, // de-DE 1252
|
||||
{ LANG_GREEK, "el" }, // el-GR 1253
|
||||
{ LANG_HINDI, "hi" }, // hi-IN
|
||||
{ LANG_HUNGARIAN, "hu" }, // hu-HU 1250
|
||||
{ LANG_ITALIAN, "it" }, // it-IT 1252
|
||||
{ LANG_JAPANESE, "ja" }, // ja-JP
|
||||
{ LANG_KOREAN, "ko" }, // ko-KR
|
||||
{ LANG_NORWEGIAN, "nn" }, // nn-NO 1252
|
||||
{ LANG_POLISH, "pl" }, // pl-PL 1250
|
||||
{ LANG_PORTUGUESE, "pt" }, // pt-PT 1252
|
||||
{ LANG_ROMANIAN, "ro" }, // ro-RO 1250
|
||||
{ LANG_RUSSIAN, "ru" }, // ru-RU 1251
|
||||
{ LANG_SPANISH, "es" }, // es-ES 1252
|
||||
{ LANG_SWEDISH, "sv" }, // sv-SE 1252
|
||||
{ LANG_UKRAINIAN, "uk" }, // uk-UA 1251
|
||||
};
|
||||
|
||||
void ASLocalizer::setLanguageFromLCID(size_t lcid)
|
||||
@ -224,16 +225,14 @@ void ASLocalizer::setLanguageFromName(const char* langID)
|
||||
// de_DE.iso88591@euro
|
||||
{
|
||||
// the constants describing the format of lang_LANG locale string
|
||||
static const size_t LEN_LANG = 2;
|
||||
|
||||
m_lcid = 0;
|
||||
string langStr = langID;
|
||||
m_langID = langStr.substr(0, LEN_LANG);
|
||||
m_langID = langStr.substr(0, 2);
|
||||
|
||||
// need the sublang for chinese
|
||||
if (m_langID == "zh" && langStr[LEN_LANG] == '_')
|
||||
if (m_langID == "zh" && langStr[2] == '_')
|
||||
{
|
||||
string subLang = langStr.substr(LEN_LANG + 1, LEN_LANG);
|
||||
string subLang = langStr.substr(3, 2);
|
||||
if (subLang == "CN" || subLang == "SG")
|
||||
m_subLangID = "CHS";
|
||||
else
|
||||
@ -262,7 +261,9 @@ void ASLocalizer::setTranslationClass()
|
||||
delete m_translation;
|
||||
m_translation = NULL;
|
||||
}
|
||||
if (m_langID == "zh" && m_subLangID == "CHS")
|
||||
if (m_langID == "bg")
|
||||
m_translation = new Bulgarian;
|
||||
else if (m_langID == "zh" && m_subLangID == "CHS")
|
||||
m_translation = new ChineseSimplified;
|
||||
else if (m_langID == "zh" && m_subLangID == "CHT")
|
||||
m_translation = new ChineseTraditional;
|
||||
@ -270,24 +271,34 @@ void ASLocalizer::setTranslationClass()
|
||||
m_translation = new Dutch;
|
||||
else if (m_langID == "en")
|
||||
m_translation = new English;
|
||||
else if (m_langID == "et")
|
||||
m_translation = new Estonian;
|
||||
else if (m_langID == "fi")
|
||||
m_translation = new Finnish;
|
||||
else if (m_langID == "fr")
|
||||
m_translation = new French;
|
||||
else if (m_langID == "de")
|
||||
m_translation = new German;
|
||||
else if (m_langID == "el")
|
||||
m_translation = new Greek;
|
||||
else if (m_langID == "hi")
|
||||
m_translation = new Hindi;
|
||||
else if (m_langID == "hu")
|
||||
m_translation = new Hungarian;
|
||||
else if (m_langID == "it")
|
||||
m_translation = new Italian;
|
||||
else if (m_langID == "ja")
|
||||
m_translation = new Japanese;
|
||||
else if (m_langID == "ko")
|
||||
m_translation = new Korean;
|
||||
else if (m_langID == "nn")
|
||||
m_translation = new Norwegian;
|
||||
else if (m_langID == "pl")
|
||||
m_translation = new Polish;
|
||||
else if (m_langID == "pt")
|
||||
m_translation = new Portuguese;
|
||||
else if (m_langID == "ro")
|
||||
m_translation = new Romanian;
|
||||
else if (m_langID == "ru")
|
||||
m_translation = new Russian;
|
||||
else if (m_langID == "es")
|
||||
@ -304,14 +315,14 @@ void ASLocalizer::setTranslationClass()
|
||||
// Translation base class methods.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void Translation::addPair(const string &english, const wstring &translated)
|
||||
void Translation::addPair(const string& english, const wstring& translated)
|
||||
// Add a string pair to the translation vector.
|
||||
{
|
||||
pair<string, wstring> entry(english, translated);
|
||||
m_translation.push_back(entry);
|
||||
}
|
||||
|
||||
string Translation::convertToMultiByte(const wstring &wideStr) const
|
||||
string Translation::convertToMultiByte(const wstring& wideStr) const
|
||||
// Convert wchar_t to a multibyte string using the currently assigned locale.
|
||||
// Return an empty string if an error occurs.
|
||||
{
|
||||
@ -351,7 +362,7 @@ size_t Translation::getTranslationVectorSize() const
|
||||
return m_translation.size();
|
||||
}
|
||||
|
||||
bool Translation::getWideTranslation(const string &stringIn, wstring &wideOut) const
|
||||
bool Translation::getWideTranslation(const string& stringIn, wstring& wideOut) const
|
||||
// Get the wide translation string. Used for testing.
|
||||
{
|
||||
for (size_t i = 0; i < m_translation.size(); i++)
|
||||
@ -367,25 +378,24 @@ bool Translation::getWideTranslation(const string &stringIn, wstring &wideOut) c
|
||||
return false;
|
||||
}
|
||||
|
||||
string &Translation::translate(const string &stringIn) const
|
||||
string& Translation::translate(const string& stringIn) const
|
||||
// Translate a string.
|
||||
// Return a static string instead of a member variable so the method can have a "const" designation.
|
||||
// Return a mutable string so the method can have a "const" designation.
|
||||
// This allows "settext" to be called from a "const" method.
|
||||
{
|
||||
static string mbTranslation;
|
||||
mbTranslation.clear();
|
||||
m_mbTranslation.clear();
|
||||
for (size_t i = 0; i < m_translation.size(); i++)
|
||||
{
|
||||
if (m_translation[i].first == stringIn)
|
||||
{
|
||||
mbTranslation = convertToMultiByte(m_translation[i].second);
|
||||
m_mbTranslation = convertToMultiByte(m_translation[i].second);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// not found, return english
|
||||
if (mbTranslation.empty())
|
||||
mbTranslation = stringIn;
|
||||
return mbTranslation;
|
||||
if (m_mbTranslation.empty())
|
||||
m_mbTranslation = stringIn;
|
||||
return m_mbTranslation;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@ -393,13 +403,45 @@ string &Translation::translate(const string &stringIn) const
|
||||
// These classes have only a constructor which builds the language vector.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Bulgarian::Bulgarian() // български
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Форматиран %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Непроменен %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"директория %s\n");
|
||||
addPair("Exclude %s\n", L"Изключвам %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Изключване (несравнимо) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s форматиран %s hепроменен ");
|
||||
addPair(" seconds ", L" секунди ");
|
||||
addPair("%d min %d sec ", L"%d мин %d сек ");
|
||||
addPair("%s lines\n", L"%s линии\n");
|
||||
addPair("Using default options file %s\n", L"Използване на файла възможности по подразбиране %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Откриване HTML документация %s\n");
|
||||
addPair("Invalid option file options:", L"Невалидни опции опция файлове:");
|
||||
addPair("Invalid command line options:", L"Невалидни опции за командния ред:");
|
||||
addPair("For help on options type 'astyle -h'", L"За помощ относно възможностите тип 'astyle -h'");
|
||||
addPair("Cannot open options file", L"Не може да се отвори файл опции");
|
||||
addPair("Cannot open directory", L"Не може да се отвори директория");
|
||||
addPair("Cannot open HTML file %s\n", L"Не може да се отвори HTML файл %s\n");
|
||||
addPair("Command execute failure", L"Command изпълни недостатъчност");
|
||||
addPair("Command is not installed", L"Command не е инсталиран");
|
||||
addPair("Missing filename in %s\n", L"Липсва името на файла в %s\n");
|
||||
addPair("Recursive option with no wildcard", L"Рекурсивно опция, без маска");
|
||||
addPair("Did you intend quote the filename", L"Знаете ли намерение да цитирам името на файла");
|
||||
addPair("No file to process %s\n", L"Не файл за обработка %s\n");
|
||||
addPair("Did you intend to use --recursive", L"Знаете ли възнамерявате да използвате --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"Не може да са UTF-32 кодиране");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style е прекратено");
|
||||
}
|
||||
|
||||
ChineseSimplified::ChineseSimplified() // 中文(简体)
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"格式化 %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"未改变 %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"目录 %s\n");
|
||||
addPair("Exclude %s\n", L"排除 %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"排除(无匹配项) %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"排除(无匹配项) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s 格式化 %s 未改变 ");
|
||||
addPair(" seconds ", L" 秒 ");
|
||||
addPair("%d min %d sec ", L"%d 分 %d 秒 ");
|
||||
@ -424,13 +466,14 @@ ChineseSimplified::ChineseSimplified() // 中文(简体)
|
||||
}
|
||||
|
||||
ChineseTraditional::ChineseTraditional() // 中文(繁體)
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"格式化 %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"未改變 %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"目錄 %s\n");
|
||||
addPair("Exclude %s\n", L"排除 %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"排除(無匹配項) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s 格式化 %s 未改變 ");
|
||||
addPair("Exclude (unmatched) %s\n", L"排除(無匹配項) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s 格式化 %s 未改變 ");
|
||||
addPair(" seconds ", L" 秒 ");
|
||||
addPair("%d min %d sec ", L"%d 分 %d 秒 ");
|
||||
addPair("%s lines\n", L"%s 行\n");
|
||||
@ -488,6 +531,37 @@ English::English()
|
||||
// this class is NOT translated
|
||||
{}
|
||||
|
||||
Estonian::Estonian() // Eesti
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Formaadis %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Muutumatu %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"Kataloog %s\n");
|
||||
addPair("Exclude %s\n", L"Välista %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Välista (tasakaalustamata) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s formaadis %s muutumatu ");
|
||||
addPair(" seconds ", L" sekundit ");
|
||||
addPair("%d min %d sec ", L"%d min %d sek ");
|
||||
addPair("%s lines\n", L"%s read\n");
|
||||
addPair("Using default options file %s\n", L"Kasutades selliseid vaikimisi valikuid faili %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Avamine HTML dokumentatsioon %s\n");
|
||||
addPair("Invalid option file options:", L"Vale valik faili võimalusi:");
|
||||
addPair("Invalid command line options:", L"Vale käsureavõtmetega:");
|
||||
addPair("For help on options type 'astyle -h'", L"Abiks võimaluste tüüp 'astyle -h'");
|
||||
addPair("Cannot open options file", L"Ei saa avada võimalusi faili");
|
||||
addPair("Cannot open directory", L"Ei saa avada kataloogi");
|
||||
addPair("Cannot open HTML file %s\n", L"Ei saa avada HTML-faili %s\n");
|
||||
addPair("Command execute failure", L"Käsk täita rike");
|
||||
addPair("Command is not installed", L"Käsk ei ole paigaldatud");
|
||||
addPair("Missing filename in %s\n", L"Kadunud failinimi %s\n");
|
||||
addPair("Recursive option with no wildcard", L"Rekursiivne võimalus ilma metamärgi");
|
||||
addPair("Did you intend quote the filename", L"Kas te kavatsete tsiteerida failinimi");
|
||||
addPair("No file to process %s\n", L"No faili töötlema %s\n");
|
||||
addPair("Did you intend to use --recursive", L"Kas te kavatsete kasutada --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"Ei saa töödelda UTF-32 kodeeringus");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style on lõpetatud");
|
||||
}
|
||||
|
||||
Finnish::Finnish() // Suomeksi
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
@ -581,6 +655,37 @@ German::German() // Deutsch
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style ist beendet");
|
||||
}
|
||||
|
||||
Greek::Greek() // ελληνικά
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Διαμορφωμένη %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Αμετάβλητος %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"Κατάλογος %s\n");
|
||||
addPair("Exclude %s\n", L"Αποκλείω %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Ausschließen (unerreichte) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s σχηματοποιημένη %s αμετάβλητες ");
|
||||
addPair(" seconds ", L" δευτερόλεπτα ");
|
||||
addPair("%d min %d sec ", L"%d λεπ %d δευ ");
|
||||
addPair("%s lines\n", L"%s γραμμές\n");
|
||||
addPair("Using default options file %s\n", L"Χρησιμοποιώντας το αρχείο προεπιλεγμένες επιλογές %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Εγκαίνια έγγραφα HTML %s\n");
|
||||
addPair("Invalid option file options:", L"Μη έγκυρες επιλογές αρχείου επιλογή:");
|
||||
addPair("Invalid command line options:", L"Μη έγκυρη επιλογές γραμμής εντολών:");
|
||||
addPair("For help on options type 'astyle -h'", L"Για βοήθεια σχετικά με το είδος επιλογές 'astyle -h'");
|
||||
addPair("Cannot open options file", L"Δεν μπορείτε να ανοίξετε το αρχείο επιλογών");
|
||||
addPair("Cannot open directory", L"Δεν μπορείτε να ανοίξετε τον κατάλογο");
|
||||
addPair("Cannot open HTML file %s\n", L"Δεν μπορείτε να ανοίξετε το αρχείο HTML %s\n");
|
||||
addPair("Command execute failure", L"Εντολή να εκτελέσει την αποτυχία");
|
||||
addPair("Command is not installed", L"Η εντολή δεν έχει εγκατασταθεί");
|
||||
addPair("Missing filename in %s\n", L"Λείπει το όνομα αρχείου σε %s\n");
|
||||
addPair("Recursive option with no wildcard", L"Αναδρομικές επιλογή χωρίς μπαλαντέρ");
|
||||
addPair("Did you intend quote the filename", L"Μήπως σκοπεύετε να αναφέρετε το όνομα του αρχείου");
|
||||
addPair("No file to process %s\n", L"Δεν υπάρχει αρχείο για την επεξεργασία %s\n");
|
||||
addPair("Did you intend to use --recursive", L"Μήπως σκοπεύετε να χρησιμοποιήσετε --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"δεν μπορεί να επεξεργαστεί UTF-32 κωδικοποίηση");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style έχει λήξει");
|
||||
}
|
||||
|
||||
Hindi::Hindi() // हिन्दी
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
@ -614,6 +719,37 @@ Hindi::Hindi() // हिन्दी
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style समाप्त किया है");
|
||||
}
|
||||
|
||||
Hungarian::Hungarian() // Magyar
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Formázott %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Változatlan %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"Címjegyzék %s\n");
|
||||
addPair("Exclude %s\n", L"Kizár %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Escludere (senza pari) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s formázott %s változatlan ");
|
||||
addPair(" seconds ", L" másodperc ");
|
||||
addPair("%d min %d sec ", L"%d jeg %d más ");
|
||||
addPair("%s lines\n", L"%s vonalak\n");
|
||||
addPair("Using default options file %s\n", L"Az alapértelmezett beállítások fájl %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Nyitó HTML dokumentáció %s\n");
|
||||
addPair("Invalid option file options:", L"Érvénytelen opció fájlbeállítást:");
|
||||
addPair("Invalid command line options:", L"Érvénytelen parancssori opciók:");
|
||||
addPair("For help on options type 'astyle -h'", L"Ha segítségre van lehetőség típus 'astyle-h'");
|
||||
addPair("Cannot open options file", L"Nem lehet megnyitni beállítási fájlban");
|
||||
addPair("Cannot open directory", L"Nem lehet megnyitni könyvtár");
|
||||
addPair("Cannot open HTML file %s\n", L"Nem lehet megnyitni a HTML fájlt %s\n");
|
||||
addPair("Command execute failure", L"Command végre hiba");
|
||||
addPair("Command is not installed", L"Parancs nincs telepítve");
|
||||
addPair("Missing filename in %s\n", L"Hiányzó fájlnév %s\n");
|
||||
addPair("Recursive option with no wildcard", L"Rekurzív kapcsolót nem wildcard");
|
||||
addPair("Did you intend quote the filename", L"Esetleg kívánja idézni a fájlnév");
|
||||
addPair("No file to process %s\n", L"Nincs fájl feldolgozása %s\n");
|
||||
addPair("Did you intend to use --recursive", L"Esetleg a használni kívánt --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"Nem tudja feldolgozni UTF-32 kódolással");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style megszűnt");
|
||||
}
|
||||
|
||||
Italian::Italian() // Italiano
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
@ -645,43 +781,45 @@ Italian::Italian() // Italiano
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style ha terminato");
|
||||
}
|
||||
|
||||
Japanese::Japanese() // 日本
|
||||
Japanese::Japanese() // 日本語
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"フォーマット %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"変更 %s\n"); // should align with formatted
|
||||
addPair("Formatted %s\n", L"フォーマット済みの %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"変わりません %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"ディレクトリ %s\n");
|
||||
addPair("Exclude %s\n", L"除外する %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"除外(マッチせず) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %sフォーマット %s 変更 ");
|
||||
addPair("Exclude (unmatched) %s\n", L"除外する(一致しません) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s フフォーマット済みの %s 変わりません ");
|
||||
addPair(" seconds ", L" 秒 ");
|
||||
addPair("%d min %d sec ", L"%d 分 %d 秒 ");
|
||||
addPair("%s lines\n", L"%s の行\n");
|
||||
addPair("Using default options file %s\n", L"デフォルトの設定ファイルを使用してください %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"HTML文書を開く %s\n");
|
||||
addPair("Invalid option file options:", L"無効なコンフィギュレーションファイルオプション:");
|
||||
addPair("%s lines\n", L"%s ライン\n");
|
||||
addPair("Using default options file %s\n", L"デフォルトのオプションファイルを使用して、 %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"オープニングHTMLドキュメント %s\n");
|
||||
addPair("Invalid option file options:", L"無効なオプションファイルのオプション:");
|
||||
addPair("Invalid command line options:", L"無効なコマンドラインオプション:");
|
||||
addPair("For help on options type 'astyle -h'", L"コマンドラインについてのヘルプは'astyle- h'を入力してください");
|
||||
addPair("Cannot open options file", L"コンフィギュレーションファイルを開くことができません");
|
||||
addPair("Cannot open directory", L"ディレクトリのオープンに失敗しました");
|
||||
addPair("For help on options type 'astyle -h'", L"コオプションの種類のヘルプについて'astyle- h'を入力してください");
|
||||
addPair("Cannot open options file", L"オプションファイルを開くことができません");
|
||||
addPair("Cannot open directory", L"ディレクトリを開くことができません。");
|
||||
addPair("Cannot open HTML file %s\n", L"HTMLファイルを開くことができません %s\n");
|
||||
addPair("Command execute failure", L"コマンドの失敗を実行");
|
||||
addPair("Command execute failure", L"コマンドが失敗を実行します");
|
||||
addPair("Command is not installed", L"コマンドがインストールされていません");
|
||||
addPair("Missing filename in %s\n", L"%s はファイル名で欠落しています\n");
|
||||
addPair("Recursive option with no wildcard", L"再帰的なオプションではワイルドカードではない");
|
||||
addPair("Did you intend quote the filename", L"あなたは、ファイル名を参照するつもり");
|
||||
addPair("No file to process %s\n", L"いいえファイルは処理できません %s\n");
|
||||
addPair("Did you intend to use --recursive", L"あなたが使用する予定 --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"UTF- 32エンコーディングを処理できない");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style 実行が終了しました");
|
||||
addPair("Missing filename in %s\n", L"%s で、ファイル名がありません\n");
|
||||
addPair("Recursive option with no wildcard", L"無ワイルドカードを使用して再帰的なオプション");
|
||||
addPair("Did you intend quote the filename", L"あなたはファイル名を引用するつもりでした");
|
||||
addPair("No file to process %s\n", L"いいえファイルは処理しないように %s\n");
|
||||
addPair("Did you intend to use --recursive", L"あなたは--recursive使用するつもりでした");
|
||||
addPair("Cannot process UTF-32 encoding", L"UTF - 32エンコーディングを処理できません");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style 終了しました");
|
||||
}
|
||||
|
||||
Korean::Korean() // 한국의
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"수정됨 %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"변경없음 %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"디렉토리 %s\n");
|
||||
addPair("Exclude %s\n", L"제외됨 %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"제외 (NO 일치) %s\n");
|
||||
addPair("Exclude %s\n", L"제외됨 %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"제외 (NO 일치) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s 수정됨 %s 변경없음 ");
|
||||
addPair(" seconds ", L" 초 ");
|
||||
addPair("%d min %d sec ", L"%d 분 %d 초 ");
|
||||
@ -705,6 +843,37 @@ Korean::Korean() // 한국의
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style를 종료합니다");
|
||||
}
|
||||
|
||||
Norwegian::Norwegian() // Norsk
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Formatert %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Uendret %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"Katalog %s\n");
|
||||
addPair("Exclude %s\n", L"Ekskluder %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Ekskluder (uovertruffen) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s formatert %s uendret ");
|
||||
addPair(" seconds ", L" sekunder ");
|
||||
addPair("%d min %d sec ", L"%d min %d sek? ");
|
||||
addPair("%s lines\n", L"%s linjer\n");
|
||||
addPair("Using default options file %s\n", L"Ved hjelp av standardalternativer fil %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Åpning HTML dokumentasjon %s\n");
|
||||
addPair("Invalid option file options:", L"Ugyldige alternativ filalternativer:");
|
||||
addPair("Invalid command line options:", L"Kommandolinjevalg Ugyldige:");
|
||||
addPair("For help on options type 'astyle -h'", L"For hjelp til alternativer type 'astyle -h'");
|
||||
addPair("Cannot open options file", L"Kan ikke åpne alternativer fil");
|
||||
addPair("Cannot open directory", L"Kan ikke åpne katalog");
|
||||
addPair("Cannot open HTML file %s\n", L"Kan ikke åpne HTML-fil %s\n");
|
||||
addPair("Command execute failure", L"Command utføre svikt");
|
||||
addPair("Command is not installed", L"Command er ikke installert");
|
||||
addPair("Missing filename in %s\n", L"Mangler filnavn i %s\n");
|
||||
addPair("Recursive option with no wildcard", L"Rekursiv alternativ uten wildcard");
|
||||
addPair("Did you intend quote the filename", L"Har du tenkt sitere filnavnet");
|
||||
addPair("No file to process %s\n", L"Ingen fil å behandle %s\n");
|
||||
addPair("Did you intend to use --recursive", L"Har du tenkt å bruke --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"Kan ikke behandle UTF-32 koding");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style har avsluttet");
|
||||
}
|
||||
|
||||
Polish::Polish() // Polski
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
@ -767,6 +936,37 @@ Portuguese::Portuguese() // Português
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style terminou");
|
||||
}
|
||||
|
||||
Romanian::Romanian() // Română
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Formatat %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Neschimbat %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"Director %s\n");
|
||||
addPair("Exclude %s\n", L"Excludeți %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Excludeți (necompensată) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s formatat %s neschimbat ");
|
||||
addPair(" seconds ", L" secunde ");
|
||||
addPair("%d min %d sec ", L"%d min %d sec ");
|
||||
addPair("%s lines\n", L"%s linii\n");
|
||||
addPair("Using default options file %s\n", L"Fișier folosind opțiunile implicite %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Documentație HTML deschidere %s\n");
|
||||
addPair("Invalid option file options:", L"Opțiuni de opțiune de fișier nevalide:");
|
||||
addPair("Invalid command line options:", L"Opțiuni de linie de comandă nevalide:");
|
||||
addPair("For help on options type 'astyle -h'", L"Pentru ajutor cu privire la tipul de opțiuni 'astyle -h'");
|
||||
addPair("Cannot open options file", L"Nu se poate deschide fișierul de opțiuni");
|
||||
addPair("Cannot open directory", L"Nu se poate deschide directorul");
|
||||
addPair("Cannot open HTML file %s\n", L"Nu se poate deschide fișierul HTML %s\n");
|
||||
addPair("Command execute failure", L"Comandă executa eșec");
|
||||
addPair("Command is not installed", L"Comanda nu este instalat");
|
||||
addPair("Missing filename in %s\n", L"Lipsă nume de fișier %s\n");
|
||||
addPair("Recursive option with no wildcard", L"Opțiunea recursiv cu nici un wildcard");
|
||||
addPair("Did you intend quote the filename", L"V-intentionati cita numele de fișier");
|
||||
addPair("No file to process %s\n", L"Nu există un fișier pentru a procesa %s\n");
|
||||
addPair("Did you intend to use --recursive", L"V-ați intenționați să utilizați --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"Nu se poate procesa codificarea UTF-32");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style a terminat");
|
||||
}
|
||||
|
||||
Russian::Russian() // русский
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
|
@ -1,28 +1,8 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* ASLocalizer.h
|
||||
*
|
||||
* Copyright (C) 2014 by Jim Pattee
|
||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>
|
||||
*
|
||||
* This file is a part of Artistic Style - an indentation and
|
||||
* reformatting tool for C, C++, C# and Java source files.
|
||||
* <http://astyle.sourceforge.net>
|
||||
*
|
||||
* Artistic Style is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Artistic Style is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Artistic Style. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*/
|
||||
// ASLocalizer.h
|
||||
// Copyright (c) 2016 by Jim Pattee <jimp03@email.com>.
|
||||
// This code is licensed under the MIT License.
|
||||
// License.txt describes the conditions under which this software may be distributed.
|
||||
|
||||
|
||||
#ifndef ASLOCALIZER_H
|
||||
#define ASLOCALIZER_H
|
||||
@ -45,26 +25,26 @@ class Translation;
|
||||
|
||||
class ASLocalizer
|
||||
{
|
||||
public: // functions
|
||||
ASLocalizer();
|
||||
virtual ~ASLocalizer();
|
||||
string getLanguageID() const;
|
||||
const Translation* getTranslationClass() const;
|
||||
public: // functions
|
||||
ASLocalizer();
|
||||
virtual ~ASLocalizer();
|
||||
string getLanguageID() const;
|
||||
const Translation* getTranslationClass() const;
|
||||
#ifdef _WIN32
|
||||
void setLanguageFromLCID(size_t lcid);
|
||||
void setLanguageFromLCID(size_t lcid);
|
||||
#endif
|
||||
void setLanguageFromName(const char* langID);
|
||||
const char* settext(const char* textIn) const;
|
||||
void setLanguageFromName(const char* langID);
|
||||
const char* settext(const char* textIn) const;
|
||||
|
||||
private: // functions
|
||||
void setTranslationClass();
|
||||
private: // functions
|
||||
void setTranslationClass();
|
||||
|
||||
private: // variables
|
||||
Translation* m_translation; // pointer to a polymorphic Translation class
|
||||
string m_langID; // language identifier from the locale
|
||||
string m_subLangID; // sub language identifier, if needed
|
||||
string m_localeName; // name of the current locale (Linux only)
|
||||
size_t m_lcid; // LCID of the user locale (Windows only)
|
||||
private: // variables
|
||||
Translation* m_translation; // pointer to a polymorphic Translation class
|
||||
string m_langID; // language identifier from the locale
|
||||
string m_subLangID; // sub language identifier, if needed
|
||||
string m_localeName; // name of the current locale (Linux only)
|
||||
size_t m_lcid; // LCID of the user locale (Windows only)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@ -79,18 +59,21 @@ class Translation
|
||||
// NOTE: This class must have virtual methods for typeid() to work.
|
||||
// typeid() is used by AStyleTestI18n_Localizer.cpp.
|
||||
{
|
||||
public:
|
||||
Translation() {}
|
||||
virtual ~Translation() {}
|
||||
string convertToMultiByte(const wstring &wideStr) const;
|
||||
size_t getTranslationVectorSize() const;
|
||||
bool getWideTranslation(const string &stringIn, wstring &wideOut) const;
|
||||
string &translate(const string &stringIn) const;
|
||||
public:
|
||||
Translation() {}
|
||||
virtual ~Translation() {}
|
||||
string convertToMultiByte(const wstring& wideStr) const;
|
||||
size_t getTranslationVectorSize() const;
|
||||
bool getWideTranslation(const string& stringIn, wstring& wideOut) const;
|
||||
string& translate(const string& stringIn) const;
|
||||
|
||||
protected:
|
||||
void addPair(const string &english, const wstring &translated);
|
||||
// variables
|
||||
vector<pair<string, wstring> > m_translation; // translation vector
|
||||
protected:
|
||||
void addPair(const string& english, const wstring& translated);
|
||||
// variables
|
||||
vector<pair<string, wstring> > m_translation; // translation vector
|
||||
|
||||
private:
|
||||
mutable string m_mbTranslation;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@ -99,107 +82,74 @@ class Translation
|
||||
// These classes have only a constructor which builds the language vector.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class Bulgarian : public Translation
|
||||
{ public: Bulgarian(); };
|
||||
|
||||
class ChineseSimplified : public Translation
|
||||
{
|
||||
public:
|
||||
ChineseSimplified();
|
||||
};
|
||||
{ public: ChineseSimplified(); };
|
||||
|
||||
class ChineseTraditional : public Translation
|
||||
{
|
||||
public:
|
||||
ChineseTraditional();
|
||||
};
|
||||
{ public: ChineseTraditional(); };
|
||||
|
||||
class Dutch : public Translation
|
||||
{
|
||||
public:
|
||||
Dutch();
|
||||
};
|
||||
{ public: Dutch(); };
|
||||
|
||||
class English : public Translation
|
||||
{
|
||||
public:
|
||||
English();
|
||||
};
|
||||
{ public: English(); };
|
||||
|
||||
class Estonian : public Translation
|
||||
{ public: Estonian(); };
|
||||
|
||||
class Finnish : public Translation
|
||||
{
|
||||
public:
|
||||
Finnish();
|
||||
};
|
||||
{ public: Finnish(); };
|
||||
|
||||
class French : public Translation
|
||||
{
|
||||
public:
|
||||
French();
|
||||
};
|
||||
{ public: French(); };
|
||||
|
||||
class German : public Translation
|
||||
{
|
||||
public:
|
||||
German();
|
||||
};
|
||||
{ public: German(); };
|
||||
|
||||
class Greek : public Translation
|
||||
{ public: Greek(); };
|
||||
|
||||
class Hindi : public Translation
|
||||
{
|
||||
public:
|
||||
Hindi();
|
||||
};
|
||||
{ public: Hindi(); };
|
||||
|
||||
class Hungarian : public Translation
|
||||
{ public: Hungarian(); };
|
||||
|
||||
class Italian : public Translation
|
||||
{
|
||||
public:
|
||||
Italian();
|
||||
};
|
||||
{ public: Italian(); };
|
||||
|
||||
class Japanese : public Translation
|
||||
{
|
||||
public:
|
||||
Japanese();
|
||||
};
|
||||
{ public: Japanese(); };
|
||||
|
||||
class Korean : public Translation
|
||||
{
|
||||
public:
|
||||
Korean();
|
||||
};
|
||||
{ public: Korean(); };
|
||||
|
||||
class Norwegian : public Translation
|
||||
{ public: Norwegian(); };
|
||||
|
||||
class Polish : public Translation
|
||||
{
|
||||
public:
|
||||
Polish();
|
||||
};
|
||||
{ public: Polish(); };
|
||||
|
||||
class Portuguese : public Translation
|
||||
{
|
||||
public:
|
||||
Portuguese();
|
||||
};
|
||||
{ public: Portuguese(); };
|
||||
|
||||
class Romanian : public Translation
|
||||
{ public: Romanian(); };
|
||||
|
||||
class Russian : public Translation
|
||||
{
|
||||
public:
|
||||
Russian();
|
||||
};
|
||||
{ public: Russian(); };
|
||||
|
||||
class Spanish : public Translation
|
||||
{
|
||||
public:
|
||||
Spanish();
|
||||
};
|
||||
{ public: Spanish(); };
|
||||
|
||||
class Swedish : public Translation
|
||||
{
|
||||
public:
|
||||
Swedish();
|
||||
};
|
||||
{ public: Swedish(); };
|
||||
|
||||
class Ukrainian : public Translation
|
||||
{
|
||||
public:
|
||||
Ukrainian();
|
||||
};
|
||||
{ public: Ukrainian(); };
|
||||
|
||||
|
||||
#endif // ASTYLE_LIB
|
||||
|
@ -1,35 +1,21 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* ASResource.cpp
|
||||
*
|
||||
* Copyright (C) 2014 by Jim Pattee
|
||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>
|
||||
*
|
||||
* This file is a part of Artistic Style - an indentation and
|
||||
* reformatting tool for C, C++, C# and Java source files.
|
||||
* <http://astyle.sourceforge.net>
|
||||
*
|
||||
* Artistic Style is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Artistic Style is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Artistic Style. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*/
|
||||
// ASResource.cpp
|
||||
// Copyright (c) 2016 by Jim Pattee <jimp03@email.com>.
|
||||
// This code is licensed under the MIT License.
|
||||
// License.txt describes the conditions under which this software may be distributed.
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// headers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "astyle.h"
|
||||
#include <algorithm>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// astyle namespace
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace astyle {
|
||||
|
||||
//
|
||||
const string ASResource::AS_IF = string("if");
|
||||
const string ASResource::AS_ELSE = string("else");
|
||||
const string ASResource::AS_FOR = string("for");
|
||||
@ -62,6 +48,7 @@ const string ASResource::AS_TRY = string("try");
|
||||
const string ASResource::AS_CATCH = string("catch");
|
||||
const string ASResource::AS_THROW = string("throw");
|
||||
const string ASResource::AS_FINALLY = string("finally");
|
||||
const string ASResource::AS_USING = string("using");
|
||||
const string ASResource::_AS_TRY = string("__try");
|
||||
const string ASResource::_AS_FINALLY = string("__finally");
|
||||
const string ASResource::_AS_EXCEPT = string("__except");
|
||||
@ -277,6 +264,7 @@ void ASResource::buildHeaders(vector<const string*>* headers, int fileType, bool
|
||||
headers->push_back(&AS_SET);
|
||||
headers->push_back(&AS_ADD);
|
||||
headers->push_back(&AS_REMOVE);
|
||||
headers->push_back(&AS_USING);
|
||||
}
|
||||
|
||||
if (beautifier)
|
||||
@ -315,17 +303,19 @@ void ASResource::buildIndentableHeaders(vector<const string*>* indentableHeaders
|
||||
*/
|
||||
void ASResource::buildIndentableMacros(vector<const pair<const string, const string>* >* indentableMacros)
|
||||
{
|
||||
// the pairs must be retained in memory
|
||||
static const struct pair<const string, const string> macros[] =
|
||||
typedef pair<const string, const string> macro_pair;
|
||||
|
||||
// the pairs must be retained in memory because of pair pointers
|
||||
static const macro_pair macros[] =
|
||||
{
|
||||
// wxWidgets
|
||||
make_pair("BEGIN_EVENT_TABLE", "END_EVENT_TABLE"),
|
||||
make_pair("wxBEGIN_EVENT_TABLE", "wxEND_EVENT_TABLE"),
|
||||
macro_pair("BEGIN_EVENT_TABLE", "END_EVENT_TABLE"),
|
||||
macro_pair("wxBEGIN_EVENT_TABLE", "wxEND_EVENT_TABLE"),
|
||||
// MFC
|
||||
make_pair("BEGIN_DISPATCH_MAP", "END_DISPATCH_MAP"),
|
||||
make_pair("BEGIN_EVENT_MAP", "END_EVENT_MAP"),
|
||||
make_pair("BEGIN_MESSAGE_MAP", "END_MESSAGE_MAP"),
|
||||
make_pair("BEGIN_PROPPAGEIDS", "END_PROPPAGEIDS"),
|
||||
macro_pair("BEGIN_DISPATCH_MAP", "END_DISPATCH_MAP"),
|
||||
macro_pair("BEGIN_EVENT_MAP", "END_EVENT_MAP"),
|
||||
macro_pair("BEGIN_MESSAGE_MAP", "END_MESSAGE_MAP"),
|
||||
macro_pair("BEGIN_PROPPAGEIDS", "END_PROPPAGEIDS"),
|
||||
};
|
||||
|
||||
size_t elements = sizeof(macros) / sizeof(macros[0]);
|
||||
@ -570,7 +560,7 @@ void ASResource::buildPreDefinitionHeaders(vector<const string*>* preDefinitionH
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
// check if a specific line position contains a keyword.
|
||||
bool ASBase::findKeyword(const string &line, int i, const string &keyword) const
|
||||
bool ASBase::findKeyword(const string& line, int i, const string& keyword) const
|
||||
{
|
||||
assert(isCharPotentialHeader(line, i));
|
||||
// check the word
|
||||
@ -586,7 +576,7 @@ bool ASBase::findKeyword(const string &line, int i, const string &keyword) const
|
||||
if (isLegalNameChar(line[wordEnd]))
|
||||
return false;
|
||||
// is not a keyword if part of a definition
|
||||
const char peekChar = peekNextChar(line, wordEnd - 1);
|
||||
const char peekChar = peekNextChar(line, (int)wordEnd - 1);
|
||||
if (peekChar == ',' || peekChar == ')')
|
||||
return false;
|
||||
return true;
|
||||
@ -594,7 +584,7 @@ bool ASBase::findKeyword(const string &line, int i, const string &keyword) const
|
||||
|
||||
// get the current word on a line
|
||||
// index must point to the beginning of the word
|
||||
string ASBase::getCurrentWord(const string &line, size_t index) const
|
||||
string ASBase::getCurrentWord(const string& line, size_t index) const
|
||||
{
|
||||
assert(isCharPotentialHeader(line, index));
|
||||
size_t lineLength = line.length();
|
||||
@ -607,4 +597,71 @@ string ASBase::getCurrentWord(const string &line, size_t index) const
|
||||
return line.substr(index, i - index);
|
||||
}
|
||||
|
||||
// check if a specific character can be used in a legal variable/method/class name
|
||||
bool ASBase::isLegalNameChar(char ch) const
|
||||
{
|
||||
if (isWhiteSpace(ch)) return false;
|
||||
if ((unsigned) ch > 127) return false;
|
||||
return (isalnum((unsigned char) ch)
|
||||
|| ch == '.' || ch == '_'
|
||||
|| (isJavaStyle() && ch == '$')
|
||||
|| (isSharpStyle() && ch == '@')); // may be used as a prefix
|
||||
}
|
||||
|
||||
// check if a specific character can be part of a header
|
||||
bool ASBase::isCharPotentialHeader(const string& line, size_t i) const
|
||||
{
|
||||
assert(!isWhiteSpace(line[i]));
|
||||
char prevCh = ' ';
|
||||
if (i > 0) prevCh = line[i - 1];
|
||||
if (!isLegalNameChar(prevCh) && isLegalNameChar(line[i]))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if a specific character can be part of an operator
|
||||
bool ASBase::isCharPotentialOperator(char ch) const
|
||||
{
|
||||
assert(!isWhiteSpace(ch));
|
||||
if ((unsigned) ch > 127) return false;
|
||||
return (ispunct((unsigned char) ch)
|
||||
&& ch != '{' && ch != '}'
|
||||
&& ch != '(' && ch != ')'
|
||||
&& ch != '[' && ch != ']'
|
||||
&& ch != ';' && ch != ','
|
||||
&& ch != '#' && ch != '\\'
|
||||
&& ch != '\'' && ch != '\"');
|
||||
}
|
||||
|
||||
// check if a specific character is a digit
|
||||
// NOTE: Visual C isdigit() gives assert error if char > 256
|
||||
bool ASBase::isDigit(char ch) const
|
||||
{
|
||||
return (ch >= '0' && ch <= '9');
|
||||
}
|
||||
|
||||
// check if a specific character is a digit separator
|
||||
bool ASBase::isDigitSeparator(const string& line, int i) const
|
||||
{
|
||||
assert(line[i] == '\'');
|
||||
// casting to (unsigned char) eliminates negative characters
|
||||
// will get a "Debug Assertion Failed" if not cast
|
||||
bool foundDigitSeparator = i > 0
|
||||
&& isxdigit((unsigned char) line[i - 1])
|
||||
&& i < (int) line.length() - 1
|
||||
&& isxdigit((unsigned char) line[i + 1]);
|
||||
return foundDigitSeparator;
|
||||
}
|
||||
|
||||
// peek at the next unread character.
|
||||
char ASBase::peekNextChar(const string& line, int i) const
|
||||
{
|
||||
char ch = ' ';
|
||||
size_t peekNum = line.find_first_not_of(" \t", i + 1);
|
||||
if (peekNum == string::npos)
|
||||
return ch;
|
||||
ch = line[peekNum];
|
||||
return ch;
|
||||
}
|
||||
|
||||
} // end namespace astyle
|
||||
|
1544
src/astyle.h
1544
src/astyle.h
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,28 +1,7 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* astyle_main.h
|
||||
*
|
||||
* Copyright (C) 2014 by Jim Pattee
|
||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>
|
||||
*
|
||||
* This file is a part of Artistic Style - an indentation and
|
||||
* reformatting tool for C, C++, C# and Java source files.
|
||||
* <http://astyle.sourceforge.net>
|
||||
*
|
||||
* Artistic Style is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Artistic Style is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Artistic Style. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*/
|
||||
// astyle_main.h
|
||||
// Copyright (c) 2016 by Jim Pattee <jimp03@email.com>.
|
||||
// This code is licensed under the MIT License.
|
||||
// License.txt describes the conditions under which this software may be distributed.
|
||||
|
||||
#ifndef ASTYLE_MAIN_H
|
||||
#define ASTYLE_MAIN_H
|
||||
@ -64,27 +43,38 @@
|
||||
#define _(a) localizer.settext(a)
|
||||
#endif // ASTYLE_LIB
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// for G++ implementation of string.compare:
|
||||
#if defined(__GNUC__) && __GNUC__ < 3
|
||||
#error - Use GNU C compiler release 3 or higher
|
||||
#endif
|
||||
|
||||
// for getenv and localtime
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4996) // secure version deprecation warnings
|
||||
#endif
|
||||
|
||||
// for namespace problem in version 5.0
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1200 // check for V6.0
|
||||
#error - Use Microsoft compiler version 6 or higher
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" // getenv, localtime
|
||||
#pragma clang diagnostic ignored "-Wmissing-braces"
|
||||
#endif
|
||||
|
||||
// for mingw BOM, UTF-16, and Unicode functions
|
||||
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
|
||||
#if (__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION < 16))
|
||||
#if (__MINGW32_MAJOR_VERSION > 3) || \
|
||||
((__MINGW32_MAJOR_VERSION == 3)&& (__MINGW32_MINOR_VERSION < 16))
|
||||
#error - Use MinGW compiler version 4 or higher
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// definitions
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifdef ASTYLE_LIB
|
||||
|
||||
// define STDCALL and EXPORT for Windows
|
||||
@ -124,7 +114,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
namespace astyle {
|
||||
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
// ASStreamIterator class
|
||||
// typename will be istringstream for GUI and istream otherwise
|
||||
@ -134,39 +124,39 @@ namespace astyle {
|
||||
template<typename T>
|
||||
class ASStreamIterator : public ASSourceIterator
|
||||
{
|
||||
public:
|
||||
bool checkForEmptyLine;
|
||||
public:
|
||||
bool checkForEmptyLine;
|
||||
|
||||
// function declarations
|
||||
ASStreamIterator(T* in);
|
||||
virtual ~ASStreamIterator();
|
||||
bool getLineEndChange(int lineEndFormat) const;
|
||||
int getStreamLength() const;
|
||||
string nextLine(bool emptyLineWasDeleted);
|
||||
string peekNextLine();
|
||||
void peekReset();
|
||||
void saveLastInputLine();
|
||||
streamoff tellg();
|
||||
// function declarations
|
||||
explicit ASStreamIterator(T* in);
|
||||
virtual ~ASStreamIterator();
|
||||
bool getLineEndChange(int lineEndFormat) const;
|
||||
int getStreamLength() const;
|
||||
string nextLine(bool emptyLineWasDeleted);
|
||||
string peekNextLine();
|
||||
void peekReset();
|
||||
void saveLastInputLine();
|
||||
streamoff tellg();
|
||||
|
||||
private:
|
||||
ASStreamIterator(const ASStreamIterator ©); // copy constructor not to be implemented
|
||||
ASStreamIterator &operator=(ASStreamIterator &); // assignment operator not to be implemented
|
||||
T* inStream; // pointer to the input stream
|
||||
string buffer; // current input line
|
||||
string prevBuffer; // previous input line
|
||||
int eolWindows; // number of Windows line endings, CRLF
|
||||
int eolLinux; // number of Linux line endings, LF
|
||||
int eolMacOld; // number of old Mac line endings. CR
|
||||
char outputEOL[4]; // next output end of line char
|
||||
streamoff streamLength; // length of the input file stream
|
||||
streamoff peekStart; // starting position for peekNextLine
|
||||
bool prevLineDeleted; // the previous input line was deleted
|
||||
private:
|
||||
ASStreamIterator(const ASStreamIterator& copy); // copy constructor not to be implemented
|
||||
ASStreamIterator& operator=(ASStreamIterator&); // assignment operator not to be implemented
|
||||
T* inStream; // pointer to the input stream
|
||||
string buffer; // current input line
|
||||
string prevBuffer; // previous input line
|
||||
string outputEOL; // next output end of line char
|
||||
int eolWindows; // number of Windows line endings, CRLF
|
||||
int eolLinux; // number of Linux line endings, LF
|
||||
int eolMacOld; // number of old Mac line endings. CR
|
||||
streamoff streamLength; // length of the input file stream
|
||||
streamoff peekStart; // starting position for peekNextLine
|
||||
bool prevLineDeleted; // the previous input line was deleted
|
||||
|
||||
public: // inline functions
|
||||
bool compareToInputBuffer(const string &nextLine_) const
|
||||
{ return (nextLine_ == prevBuffer); }
|
||||
const char* getOutputEOL() const { return outputEOL; }
|
||||
bool hasMoreLines() const { return !inStream->eof(); }
|
||||
public: // inline functions
|
||||
bool compareToInputBuffer(const string& nextLine_) const
|
||||
{ return (nextLine_ == prevBuffer); }
|
||||
const string& getOutputEOL() const { return outputEOL; }
|
||||
bool hasMoreLines() const { return !inStream->eof(); }
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@ -175,26 +165,26 @@ class ASStreamIterator : public ASSourceIterator
|
||||
|
||||
class Utf8_16
|
||||
{
|
||||
private:
|
||||
typedef unsigned short utf16; // 16 bits
|
||||
typedef unsigned char utf8; // 8 bits
|
||||
typedef unsigned char ubyte; // 8 bits
|
||||
enum { SURROGATE_LEAD_FIRST = 0xD800 };
|
||||
enum { SURROGATE_LEAD_LAST = 0xDBFF };
|
||||
enum { SURROGATE_TRAIL_FIRST = 0xDC00 };
|
||||
enum { SURROGATE_TRAIL_LAST = 0xDFFF };
|
||||
enum { SURROGATE_FIRST_VALUE = 0x10000 };
|
||||
enum eState { eStart, eSecondOf4Bytes, ePenultimate, eFinal };
|
||||
private:
|
||||
typedef unsigned short utf16; // 16 bits
|
||||
typedef unsigned char utf8; // 8 bits
|
||||
typedef unsigned char ubyte; // 8 bits
|
||||
enum { SURROGATE_LEAD_FIRST = 0xD800 };
|
||||
enum { SURROGATE_LEAD_LAST = 0xDBFF };
|
||||
enum { SURROGATE_TRAIL_FIRST = 0xDC00 };
|
||||
enum { SURROGATE_TRAIL_LAST = 0xDFFF };
|
||||
enum { SURROGATE_FIRST_VALUE = 0x10000 };
|
||||
enum eState { eStart, eSecondOf4Bytes, ePenultimate, eFinal };
|
||||
|
||||
public:
|
||||
bool getBigEndian() const;
|
||||
int swap16bit(int value) const;
|
||||
size_t utf16len(const utf16* utf16In) const;
|
||||
size_t Utf8LengthFromUtf16(const char* utf16In, size_t inLen, bool isBigEndian) const;
|
||||
size_t Utf8ToUtf16(char* utf8In, size_t inLen, bool isBigEndian, char* utf16Out) const;
|
||||
size_t Utf16LengthFromUtf8(const char* utf8In, size_t inLen) const;
|
||||
size_t Utf16ToUtf8(char* utf16In, size_t inLen, bool isBigEndian,
|
||||
bool firstBlock, char* utf8Out) const;
|
||||
public:
|
||||
bool getBigEndian() const;
|
||||
int swap16bit(int value) const;
|
||||
size_t utf16len(const utf16* utf16In) const;
|
||||
size_t utf8LengthFromUtf16(const char* utf16In, size_t inLen, bool isBigEndian) const;
|
||||
size_t utf8ToUtf16(char* utf8In, size_t inLen, bool isBigEndian, char* utf16Out) const;
|
||||
size_t utf16LengthFromUtf8(const char* utf8In, size_t inLen) const;
|
||||
size_t utf16ToUtf8(char* utf16In, size_t inLen, bool isBigEndian,
|
||||
bool firstBlock, char* utf8Out) const;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@ -204,27 +194,28 @@ class Utf8_16
|
||||
|
||||
class ASOptions
|
||||
{
|
||||
public:
|
||||
ASOptions(ASFormatter &formatterArg) : formatter(formatterArg) {}
|
||||
string getOptionErrors() const;
|
||||
void importOptions(istream &in, vector<string> &optionsVector);
|
||||
bool parseOptions(vector<string> &optionsVector, const string &errorInfo);
|
||||
public:
|
||||
explicit ASOptions(ASFormatter& formatterArg) : formatter(formatterArg) {}
|
||||
string getOptionErrors() const;
|
||||
void importOptions(istream& in, vector<string>& optionsVector);
|
||||
bool parseOptions(vector<string>& optionsVector, const string& errorInfo);
|
||||
|
||||
private:
|
||||
// variables
|
||||
ASFormatter &formatter; // reference to the ASFormatter object
|
||||
stringstream optionErrors; // option error messages
|
||||
private:
|
||||
// variables
|
||||
ASFormatter& formatter; // reference to the ASFormatter object
|
||||
stringstream optionErrors; // option error messages
|
||||
|
||||
// functions
|
||||
ASOptions &operator=(ASOptions &); // not to be implemented
|
||||
string getParam(const string &arg, const char* op);
|
||||
string getParam(const string &arg, const char* op1, const char* op2);
|
||||
bool isOption(const string &arg, const char* op);
|
||||
bool isOption(const string &arg, const char* op1, const char* op2);
|
||||
void isOptionError(const string &arg, const string &errorInfo);
|
||||
bool isParamOption(const string &arg, const char* option);
|
||||
bool isParamOption(const string &arg, const char* option1, const char* option2);
|
||||
void parseOption(const string &arg, const string &errorInfo);
|
||||
// functions
|
||||
ASOptions(const ASOptions&); // copy constructor not to be implemented
|
||||
ASOptions& operator=(ASOptions&); // assignment operator not to be implemented
|
||||
string getParam(const string& arg, const char* op);
|
||||
string getParam(const string& arg, const char* op1, const char* op2);
|
||||
bool isOption(const string& arg, const char* op);
|
||||
bool isOption(const string& arg, const char* op1, const char* op2);
|
||||
void isOptionError(const string& arg, const string& errorInfo);
|
||||
bool isParamOption(const string& arg, const char* option);
|
||||
bool isParamOption(const string& arg, const char* option1, const char* option2);
|
||||
void parseOption(const string& arg, const string& errorInfo);
|
||||
};
|
||||
|
||||
#ifndef ASTYLE_LIB
|
||||
@ -235,153 +226,152 @@ class ASOptions
|
||||
|
||||
class ASConsole
|
||||
{
|
||||
private: // variables
|
||||
ASFormatter &formatter; // reference to the ASFormatter object
|
||||
ASLocalizer localizer; // ASLocalizer object
|
||||
private: // variables
|
||||
ASFormatter& formatter; // reference to the ASFormatter object
|
||||
ASLocalizer localizer; // ASLocalizer object
|
||||
// command line options
|
||||
bool isRecursive; // recursive option
|
||||
bool isDryRun; // dry-run option
|
||||
bool noBackup; // suffix=none option
|
||||
bool preserveDate; // preserve-date option
|
||||
bool isVerbose; // verbose option
|
||||
bool isQuiet; // quiet option
|
||||
bool isFormattedOnly; // formatted lines only option
|
||||
bool ignoreExcludeErrors; // don't abort on unmatched excludes
|
||||
bool ignoreExcludeErrorsDisplay; // don't display unmatched excludes
|
||||
bool optionsFileRequired; // options= option
|
||||
bool useAscii; // ascii option
|
||||
// other variables
|
||||
bool bypassBrowserOpen; // don't open the browser on html options
|
||||
bool hasWildcard; // file name includes a wildcard
|
||||
size_t mainDirectoryLength; // directory length to be excluded in displays
|
||||
bool filesAreIdentical; // input and output files are identical
|
||||
int filesFormatted; // number of files formatted
|
||||
int filesUnchanged; // number of files unchanged
|
||||
bool lineEndsMixed; // output has mixed line ends
|
||||
int linesOut; // number of output lines
|
||||
|
||||
Utf8_16 utf8_16; // utf8/16 conversion methods
|
||||
|
||||
string outputEOL; // current line end
|
||||
string prevEOL; // previous line end
|
||||
string optionsFileName; // file path and name of the options file to use
|
||||
string origSuffix; // suffix= option
|
||||
string targetDirectory; // path to the directory being processed
|
||||
string targetFilename; // file name being processed
|
||||
|
||||
vector<string> excludeVector; // exclude from wildcard hits
|
||||
vector<bool> excludeHitsVector; // exclude flags for error reporting
|
||||
vector<string> fileNameVector; // file paths and names from the command line
|
||||
vector<string> optionsVector; // options from the command line
|
||||
vector<string> fileOptionsVector; // options from the options file
|
||||
vector<string> fileName; // files to be processed including path
|
||||
|
||||
public: // variables
|
||||
explicit ASConsole(ASFormatter& formatterArg) : formatter(formatterArg)
|
||||
{
|
||||
// command line options
|
||||
bool isRecursive; // recursive option
|
||||
bool isDryRun; // dry-run option
|
||||
bool noBackup; // suffix=none option
|
||||
bool preserveDate; // preserve-date option
|
||||
bool isVerbose; // verbose option
|
||||
bool isQuiet; // quiet option
|
||||
bool isFormattedOnly; // formatted lines only option
|
||||
bool ignoreExcludeErrors; // don't abort on unmatched excludes
|
||||
bool ignoreExcludeErrorsDisplay; // don't display unmatched excludes
|
||||
bool optionsFileRequired; // options= option
|
||||
bool useAscii; // ascii option
|
||||
isRecursive = false;
|
||||
isDryRun = false;
|
||||
noBackup = false;
|
||||
preserveDate = false;
|
||||
isVerbose = false;
|
||||
isQuiet = false;
|
||||
isFormattedOnly = false;
|
||||
ignoreExcludeErrors = false;
|
||||
ignoreExcludeErrorsDisplay = false;
|
||||
optionsFileRequired = false;
|
||||
useAscii = false;
|
||||
// other variables
|
||||
bool bypassBrowserOpen; // don't open the browser on html options
|
||||
bool hasWildcard; // file name includes a wildcard
|
||||
size_t mainDirectoryLength; // directory length to be excluded in displays
|
||||
bool filesAreIdentical; // input and output files are identical
|
||||
int filesFormatted; // number of files formatted
|
||||
int filesUnchanged; // number of files unchanged
|
||||
bool lineEndsMixed; // output has mixed line ends
|
||||
int linesOut; // number of output lines
|
||||
char outputEOL[4]; // current line end
|
||||
char prevEOL[4]; // previous line end
|
||||
bypassBrowserOpen = false;
|
||||
hasWildcard = false;
|
||||
filesAreIdentical = true;
|
||||
lineEndsMixed = false;
|
||||
origSuffix = ".orig";
|
||||
mainDirectoryLength = 0;
|
||||
filesFormatted = 0;
|
||||
filesUnchanged = 0;
|
||||
linesOut = 0;
|
||||
}
|
||||
|
||||
Utf8_16 utf8_16; // utf8/16 conversion methods
|
||||
public: // functions
|
||||
void convertLineEnds(ostringstream& out, int lineEnd);
|
||||
FileEncoding detectEncoding(const char* data, size_t dataSize) const;
|
||||
void error() const;
|
||||
void error(const char* why, const char* what) const;
|
||||
void formatCinToCout();
|
||||
vector<string> getArgvOptions(int argc, char** argv) const;
|
||||
bool fileNameVectorIsEmpty() const;
|
||||
bool getFilesAreIdentical() const;
|
||||
int getFilesFormatted() const;
|
||||
bool getIgnoreExcludeErrors() const;
|
||||
bool getIgnoreExcludeErrorsDisplay() const;
|
||||
bool getIsDryRun() const;
|
||||
bool getIsFormattedOnly() const;
|
||||
bool getIsQuiet() const;
|
||||
bool getIsRecursive() const;
|
||||
bool getIsVerbose() const;
|
||||
bool getLineEndsMixed() const;
|
||||
bool getNoBackup() const;
|
||||
bool getPreserveDate() const;
|
||||
string getLanguageID() const;
|
||||
string getNumberFormat(int num, size_t = 0) const;
|
||||
string getNumberFormat(int num, const char* groupingArg, const char* separator) const;
|
||||
string getOptionsFileName() const;
|
||||
string getOrigSuffix() const;
|
||||
void processFiles();
|
||||
void processOptions(vector<string>& argvOptions);
|
||||
void setBypassBrowserOpen(bool state);
|
||||
void setIgnoreExcludeErrors(bool state);
|
||||
void setIgnoreExcludeErrorsAndDisplay(bool state);
|
||||
void setIsDryRun(bool state);
|
||||
void setIsFormattedOnly(bool state);
|
||||
void setIsQuiet(bool state);
|
||||
void setIsRecursive(bool state);
|
||||
void setIsVerbose(bool state);
|
||||
void setNoBackup(bool state);
|
||||
void setOptionsFileName(string name);
|
||||
void setOrigSuffix(string suffix);
|
||||
void setPreserveDate(bool state);
|
||||
void standardizePath(string& path, bool removeBeginningSeparator = false) const;
|
||||
bool stringEndsWith(const string& str, const string& suffix) const;
|
||||
void updateExcludeVector(string suffixParam);
|
||||
vector<string> getExcludeVector() const;
|
||||
vector<bool> getExcludeHitsVector() const;
|
||||
vector<string> getFileNameVector() const;
|
||||
vector<string> getOptionsVector() const;
|
||||
vector<string> getFileOptionsVector() const;
|
||||
vector<string> getFileName() const;
|
||||
|
||||
string optionsFileName; // file path and name of the options file to use
|
||||
string origSuffix; // suffix= option
|
||||
string targetDirectory; // path to the directory being processed
|
||||
string targetFilename; // file name being processed
|
||||
|
||||
vector<string> excludeVector; // exclude from wildcard hits
|
||||
vector<bool> excludeHitsVector; // exclude flags for error reporting
|
||||
vector<string> fileNameVector; // file paths and names from the command line
|
||||
vector<string> optionsVector; // options from the command line
|
||||
vector<string> fileOptionsVector; // options from the options file
|
||||
vector<string> fileName; // files to be processed including path
|
||||
|
||||
public: // variables
|
||||
ASConsole(ASFormatter &formatterArg) : formatter(formatterArg) {
|
||||
// command line options
|
||||
isRecursive = false;
|
||||
isDryRun = false;
|
||||
noBackup = false;
|
||||
preserveDate = false;
|
||||
isVerbose = false;
|
||||
isQuiet = false;
|
||||
isFormattedOnly = false;
|
||||
ignoreExcludeErrors = false;
|
||||
ignoreExcludeErrorsDisplay = false;
|
||||
optionsFileRequired = false;
|
||||
useAscii = false;
|
||||
// other variables
|
||||
bypassBrowserOpen = false;
|
||||
hasWildcard = false;
|
||||
filesAreIdentical = true;
|
||||
lineEndsMixed = false;
|
||||
outputEOL[0] = '\0';
|
||||
prevEOL[0] = '\0';
|
||||
origSuffix = ".orig";
|
||||
mainDirectoryLength = 0;
|
||||
filesFormatted = 0;
|
||||
filesUnchanged = 0;
|
||||
linesOut = 0;
|
||||
}
|
||||
|
||||
public: // functions
|
||||
void convertLineEnds(ostringstream &out, int lineEnd);
|
||||
FileEncoding detectEncoding(const char* data, size_t dataSize) const;
|
||||
void error() const;
|
||||
void error(const char* why, const char* what) const;
|
||||
void formatCinToCout();
|
||||
vector<string> getArgvOptions(int argc, char** argv) const;
|
||||
bool fileNameVectorIsEmpty() const;
|
||||
bool getFilesAreIdentical() const;
|
||||
int getFilesFormatted() const;
|
||||
bool getIgnoreExcludeErrors() const;
|
||||
bool getIgnoreExcludeErrorsDisplay() const;
|
||||
bool getIsDryRun() const;
|
||||
bool getIsFormattedOnly() const;
|
||||
bool getIsQuiet() const;
|
||||
bool getIsRecursive() const;
|
||||
bool getIsVerbose() const;
|
||||
bool getLineEndsMixed() const;
|
||||
bool getNoBackup() const;
|
||||
bool getPreserveDate() const;
|
||||
string getLanguageID() const;
|
||||
string getNumberFormat(int num, size_t = 0) const;
|
||||
string getNumberFormat(int num, const char* groupingArg, const char* separator) const;
|
||||
string getOptionsFileName() const;
|
||||
string getOrigSuffix() const;
|
||||
void processFiles();
|
||||
void processOptions(vector<string> &argvOptions);
|
||||
void setBypassBrowserOpen(bool state);
|
||||
void setIgnoreExcludeErrors(bool state);
|
||||
void setIgnoreExcludeErrorsAndDisplay(bool state);
|
||||
void setIsDryRun(bool state);
|
||||
void setIsFormattedOnly(bool state);
|
||||
void setIsQuiet(bool state);
|
||||
void setIsRecursive(bool state);
|
||||
void setIsVerbose(bool state);
|
||||
void setNoBackup(bool state);
|
||||
void setOptionsFileName(string name);
|
||||
void setOrigSuffix(string suffix);
|
||||
void setPreserveDate(bool state);
|
||||
void standardizePath(string &path, bool removeBeginningSeparator = false) const;
|
||||
bool stringEndsWith(const string &str, const string &suffix) const;
|
||||
void updateExcludeVector(string suffixParam);
|
||||
vector<string> getExcludeVector() const;
|
||||
vector<bool> getExcludeHitsVector() const;
|
||||
vector<string> getFileNameVector() const;
|
||||
vector<string> getOptionsVector() const;
|
||||
vector<string> getFileOptionsVector() const;
|
||||
vector<string> getFileName() const;
|
||||
|
||||
private: // functions
|
||||
ASConsole &operator=(ASConsole &); // not to be implemented
|
||||
void correctMixedLineEnds(ostringstream &out);
|
||||
void formatFile(const string &fileName_);
|
||||
string getCurrentDirectory(const string &fileName_) const;
|
||||
void getFileNames(const string &directory, const string &wildcard);
|
||||
void getFilePaths(string &filePath);
|
||||
string getParam(const string &arg, const char* op);
|
||||
void initializeOutputEOL(LineEndFormat lineEndFormat);
|
||||
bool isOption(const string &arg, const char* op);
|
||||
bool isOption(const string &arg, const char* op1, const char* op2);
|
||||
bool isParamOption(const string &arg, const char* option);
|
||||
bool isPathExclued(const string &subPath);
|
||||
void launchDefaultBrowser(const char* filePathIn = NULL) const;
|
||||
void printHelp() const;
|
||||
void printMsg(const char* msg, const string &data) const;
|
||||
void printSeparatingLine() const;
|
||||
void printVerboseHeader() const;
|
||||
void printVerboseStats(clock_t startTime) const;
|
||||
FileEncoding readFile(const string &fileName_, stringstream &in) const;
|
||||
void removeFile(const char* fileName_, const char* errMsg) const;
|
||||
void renameFile(const char* oldFileName, const char* newFileName, const char* errMsg) const;
|
||||
void setOutputEOL(LineEndFormat lineEndFormat, const char* currentEOL);
|
||||
void sleep(int seconds) const;
|
||||
int waitForRemove(const char* oldFileName) const;
|
||||
int wildcmp(const char* wild, const char* data) const;
|
||||
void writeFile(const string &fileName_, FileEncoding encoding, ostringstream &out) const;
|
||||
private: // functions
|
||||
ASConsole& operator=(ASConsole&); // not to be implemented
|
||||
void correctMixedLineEnds(ostringstream& out);
|
||||
void formatFile(const string& fileName_);
|
||||
string getCurrentDirectory(const string& fileName_) const;
|
||||
void getFileNames(const string& directory, const string& wildcard);
|
||||
void getFilePaths(string& filePath);
|
||||
string getParam(const string& arg, const char* op);
|
||||
void initializeOutputEOL(LineEndFormat lineEndFormat);
|
||||
bool isOption(const string& arg, const char* op);
|
||||
bool isOption(const string& arg, const char* op1, const char* op2);
|
||||
bool isParamOption(const string& arg, const char* option);
|
||||
bool isPathExclued(const string& subPath);
|
||||
void launchDefaultBrowser(const char* filePathIn = NULL) const;
|
||||
void printHelp() const;
|
||||
void printMsg(const char* msg, const string& data) const;
|
||||
void printSeparatingLine() const;
|
||||
void printVerboseHeader() const;
|
||||
void printVerboseStats(clock_t startTime) const;
|
||||
FileEncoding readFile(const string& fileName_, stringstream& in) const;
|
||||
void removeFile(const char* fileName_, const char* errMsg) const;
|
||||
void renameFile(const char* oldFileName, const char* newFileName, const char* errMsg) const;
|
||||
void setOutputEOL(LineEndFormat lineEndFormat, const string& currentEOL);
|
||||
void sleep(int seconds) const;
|
||||
int waitForRemove(const char* oldFileName) const;
|
||||
int wildcmp(const char* wild, const char* data) const;
|
||||
void writeFile(const string& fileName_, FileEncoding encoding, ostringstream& out) const;
|
||||
#ifdef _WIN32
|
||||
void displayLastError();
|
||||
void displayLastError();
|
||||
#endif
|
||||
};
|
||||
#else // ASTYLE_LIB
|
||||
@ -392,19 +382,19 @@ class ASConsole
|
||||
|
||||
class ASLibrary
|
||||
{
|
||||
public:
|
||||
ASLibrary() {}
|
||||
virtual ~ASLibrary() {}
|
||||
// virtual functions are mocked in testing
|
||||
utf16_t* formatUtf16(const utf16_t*, const utf16_t*, fpError, fpAlloc) const;
|
||||
virtual utf16_t* convertUtf8ToUtf16(const char* utf8In, fpAlloc fpMemoryAlloc) const;
|
||||
virtual char* convertUtf16ToUtf8(const utf16_t* pSourceIn) const;
|
||||
public:
|
||||
ASLibrary() {}
|
||||
virtual ~ASLibrary() {}
|
||||
// virtual functions are mocked in testing
|
||||
utf16_t* formatUtf16(const utf16_t*, const utf16_t*, fpError, fpAlloc) const;
|
||||
virtual utf16_t* convertUtf8ToUtf16(const char* utf8In, fpAlloc fpMemoryAlloc) const;
|
||||
virtual char* convertUtf16ToUtf8(const utf16_t* pSourceIn) const;
|
||||
|
||||
private:
|
||||
static char* STDCALL tempMemoryAllocation(unsigned long memoryNeeded);
|
||||
private:
|
||||
static char* STDCALL tempMemoryAllocation(unsigned long memoryNeeded);
|
||||
|
||||
private:
|
||||
Utf8_16 utf8_16; // utf8/16 conversion methods
|
||||
private:
|
||||
Utf8_16 utf8_16; // utf8/16 conversion methods
|
||||
};
|
||||
|
||||
#endif // ASTYLE_LIB
|
||||
|
Loading…
Reference in New Issue
Block a user