Initial commit with astyle version 2.05.1
This commit is contained in:
commit
c8638db9b4
59
.gitignore
vendored
Normal file
59
.gitignore
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
|
||||
# Python
|
||||
*.pyc
|
||||
|
||||
# astyle-specific files and folders
|
||||
/AStyle
|
||||
|
||||
# For projects that use Waf for building: http://code.google.com/p/waf/
|
||||
waf-*
|
||||
.waf-*
|
||||
.waf3-*
|
||||
.lock-*
|
||||
build
|
||||
bundle_dependencies
|
||||
|
||||
# Gnu Global tag files
|
||||
GPATH
|
||||
GRTAGS
|
||||
GSYMS
|
||||
GTAGS
|
||||
|
||||
# Emacs temp / auto save
|
||||
\#*#
|
||||
*.#*
|
||||
*~
|
||||
|
||||
#Eclipse ignore
|
||||
.cproject
|
||||
*.project
|
||||
.metadata
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
|
||||
# Visual Studio ignore
|
||||
/bin
|
||||
*.bat
|
||||
*.sln
|
||||
*.suo
|
||||
*.user
|
||||
*.ncb
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.log
|
||||
VSProjects
|
||||
|
||||
|
9
NEWS.rst
Normal file
9
NEWS.rst
Normal file
@ -0,0 +1,9 @@
|
||||
News for astyle
|
||||
===============
|
||||
|
||||
This file lists the major changes between versions. For a more detailed list
|
||||
of every change, see the Git log.
|
||||
|
||||
Latest
|
||||
------
|
||||
* tbd
|
15
README.rst
Normal file
15
README.rst
Normal file
@ -0,0 +1,15 @@
|
||||
======
|
||||
astyle
|
||||
======
|
||||
|
||||
This is a modified version of astyle: http://astyle.sourceforge.net
|
||||
|
||||
Our intention is to patch astyle to follow the Steinwurf coding style
|
||||
as closely as possible: http://docs.steinwurf.com/coding_style.html
|
||||
|
||||
Steinwurf uses heavily-templated C++11 code that can be a true challenge
|
||||
for a code formatting tool.
|
||||
|
||||
|
||||
|
||||
|
2386
doc/astyle.html
Normal file
2386
doc/astyle.html
Normal file
File diff suppressed because it is too large
Load Diff
476
doc/install.html
Normal file
476
doc/install.html
Normal file
@ -0,0 +1,476 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<title>Artistic Style - Install Information</title>
|
||||
<meta http-equiv="Content-Language" content="en-us" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
|
||||
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
|
||||
<link href="styles.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Artistic Style Install Information
|
||||
</h1>
|
||||
|
||||
<p>
|
||||
|
||||
</p>
|
||||
|
||||
<h3 id="Contents">
|
||||
Contents
|
||||
</h3>
|
||||
|
||||
<p class="contents1">
|
||||
<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>
|
||||
<p class="contents2">
|
||||
<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>
|
||||
<p class="contents2">
|
||||
<a class="contents" href="#_Clang_Compiler">Clang Compiler</a>
|
||||
</p>
|
||||
<p class="contents2">
|
||||
<a class="contents" href="#_Intel_Compiler">Intel Compiler</a>
|
||||
</p>
|
||||
<p class="contents1">
|
||||
<a class="contents" href="#_Mac_OS_X_Version">Mac OS X Version</a>
|
||||
</p>
|
||||
<p class="contents2">
|
||||
<a class="contents" href="#_Xcode">Xcode</a>
|
||||
</p>
|
||||
<p class="contents2">
|
||||
<a class="contents" href="#_Makefile">Makefile</a>
|
||||
</p>
|
||||
<p class="contents1">
|
||||
<a class="contents" href="#_Windows_Version">Windows Version</a>
|
||||
</p>
|
||||
<p class="contents2">
|
||||
<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>
|
||||
<p class="contents2">
|
||||
<a class="contents" href="#_Other_Compilers">Other Compilers</a>
|
||||
</p>
|
||||
<p class="contents1">
|
||||
<a class="contents" href="#_Compiler_Options">Compiler Options</a>
|
||||
</p>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<h3 id="_Linux_Version">
|
||||
Linux Version
|
||||
</h3>
|
||||
|
||||
<h4 id="_GCC_Compiler">
|
||||
GCC Compiler
|
||||
</h4>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<li><b>staticdebug </b>builds the Artistic Style program as a static library with debugging information (libastyled.a).
|
||||
</li>
|
||||
<li><b>all </b>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>
|
||||
</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
|
||||
(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>
|
||||
<pre>cd astyle/build/gcc<br />make release shared static</pre>
|
||||
|
||||
<h4 id="_Other_Makefile_Options">
|
||||
Other Makefile Options
|
||||
</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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<h3 id="_Mac_OS_X_Version">
|
||||
Mac OS X 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>
|
||||
<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
|
||||
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>
|
||||
</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>
|
||||
<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>
|
||||
<pre>sudo bash install.sh
|
||||
</pre>
|
||||
<h5>uninstall
|
||||
</h5>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<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 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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<h3 id="_Windows_Version">
|
||||
Windows Version
|
||||
</h3>
|
||||
|
||||
<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>
|
||||
|
||||
<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.
|
||||
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>
|
||||
<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>
|
||||
</ul>
|
||||
|
||||
<h4 id="_Other_Compilers">
|
||||
Other Compilers
|
||||
</h4>
|
||||
|
||||
<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>
|
||||
<li>The Compiler Options section discusses the compiler options to use.</li>
|
||||
<li>Compile.</li>
|
||||
</ul>
|
||||
|
||||
<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
|
||||
messages. Use the appropriate compiler and linker options to compile the static or shared library. Add debug
|
||||
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
|
||||
used. Use whole program optimization if your compiler supports it. There may be other options you can use depending
|
||||
on the compiler.
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
|
||||
<center style="margin-left: -0.4in;">
|
||||
<a href="http://sourceforge.net/projects/astyle">
|
||||
<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2319&type=16" alt="" />
|
||||
</a>
|
||||
</center>
|
||||
|
||||
<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 -->
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
236
doc/license.html
Normal file
236
doc/license.html
Normal file
@ -0,0 +1,236 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<title>Artistic Style License</title>
|
||||
<meta http-equiv="Content-Language" content="en-us" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
|
||||
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
|
||||
<style type="text/css">
|
||||
/*<![CDATA[*/
|
||||
body { background-color: white; margin-top: 0.5in; margin-right: 0.8in; margin-bottom: 0.5in; margin-left: 0.8in; }
|
||||
|
||||
h1 { color: #0000A0; text-align: center; font-style: italic; font-size: xx-large; }
|
||||
h2 { color: #0000A0; }
|
||||
h3 { color: #0000A0; }
|
||||
h4 { color: #0000A0; font-size: large; }
|
||||
|
||||
a:link, a:visited { color: #0000A0; text-decoration: underline; }
|
||||
a:hover { color: #F00000; text-decoration: underline; }
|
||||
|
||||
img { border: none; }
|
||||
/*]]>*/
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Artistic Style License</h1>
|
||||
|
||||
<p>
|
||||
<span style="color: #0000A0"><b>Artistic Style</b></span> may be used and/or modified and/or distributed under
|
||||
the <a href="http://www.gnu.org/licenses/lgpl.html"><b>GNU Lesser General Public License (LGPL)</b></a>, as detailed
|
||||
below. The LGPL is a set of additional permissions added to version 3 of the <a href="http://www.gnu.org/licenses/gpl-3.0.html">
|
||||
GNU General Public License</a>.
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
|
||||
<h2 style="text-align: center;">GNU LESSER GENERAL PUBLIC LICENSE</h2>
|
||||
|
||||
<p style="text-align: center;">
|
||||
Version 3, 29 June 2007
|
||||
</p>
|
||||
<p>
|
||||
Copyright © 2007 Free Software Foundation, Inc. <<a href="http://fsf.org/">http://fsf.org/</a>>
|
||||
</p>
|
||||
<p>
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not
|
||||
allowed.
|
||||
</p>
|
||||
<p>
|
||||
This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the
|
||||
GNU General Public License, supplemented by the additional permissions listed below.
|
||||
</p>
|
||||
|
||||
<h4>
|
||||
<a name="section0"></a>0. Additional Definitions.</h4>
|
||||
|
||||
<p>
|
||||
As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the
|
||||
“GNU GPL” refers to version 3 of the GNU General Public License.
|
||||
</p>
|
||||
<p>
|
||||
“The Library” refers to a covered work governed by this License, other than an Application or a Combined
|
||||
Work as defined below.
|
||||
</p>
|
||||
<p>
|
||||
An “Application” is any work that makes use of an interface provided by the Library, but which is
|
||||
not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of
|
||||
using an interface provided by the Library.
|
||||
</p>
|
||||
<p>
|
||||
A “Combined Work” is a work produced by combining or linking an Application with the Library. The
|
||||
particular version of the Library with which the Combined Work was made is also called the “Linked Version”.
|
||||
</p>
|
||||
<p>
|
||||
The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined
|
||||
Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on
|
||||
the Application, and not on the Linked Version.
|
||||
</p>
|
||||
<p>
|
||||
The “Corresponding Application Code” for a Combined Work means the object code and/or source code
|
||||
for the Application, including any data and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
</p>
|
||||
|
||||
<h4>
|
||||
<a name="section1"></a>1. Exception to Section 3 of the GNU GPL.</h4>
|
||||
|
||||
<p>
|
||||
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU
|
||||
GPL.
|
||||
</p>
|
||||
|
||||
<h4>
|
||||
<a name="section2"></a>2. Conveying Modified Versions.</h4>
|
||||
|
||||
<p>
|
||||
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be
|
||||
supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked),
|
||||
then you may convey a copy of the modified version:
|
||||
</p>
|
||||
<ul>
|
||||
<li>a) under this License, provided that you make a good faith effort to ensure that, in the event an Application
|
||||
does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains
|
||||
meaningful, or</li>
|
||||
<li>b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.</li>
|
||||
</ul>
|
||||
|
||||
<h4>
|
||||
<a name="section3"></a>3. Object Code Incorporating Material from Library Header Files.</h4>
|
||||
|
||||
<p>
|
||||
The object code form of an Application may incorporate material from a header file that is part of the Library.
|
||||
You may convey such object code under terms of your choice, provided that, if the incorporated material is not
|
||||
limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
</p>
|
||||
<ul>
|
||||
<li>a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library
|
||||
and its use are covered by this License.</li>
|
||||
<li>b) Accompany the object code with a copy of the GNU GPL and this license document.</li>
|
||||
</ul>
|
||||
|
||||
<h4>
|
||||
<a name="section4"></a>4. Combined Works.</h4>
|
||||
|
||||
<p>
|
||||
You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification
|
||||
of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications,
|
||||
if you also do each of the following:
|
||||
</p>
|
||||
<ul>
|
||||
<li>a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library
|
||||
and its use are covered by this License.</li>
|
||||
<li>b) Accompany the Combined Work with a copy of the GNU GPL and this license document.</li>
|
||||
<li>c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the
|
||||
Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license
|
||||
document.</li>
|
||||
<li>d) Do one of the following:
|
||||
<ul>
|
||||
<li>0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application
|
||||
Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with
|
||||
a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section
|
||||
6 of the GNU GPL for conveying Corresponding Source.</li>
|
||||
<li>1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a)
|
||||
uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly
|
||||
with a modified version of the Library that is interface-compatible with the Linked Version.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>e) Provide Installation Information, but only if you would otherwise be required to provide such information under
|
||||
section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified
|
||||
version of the Combined Work produced by recombining or relinking the Application with a modified version of the
|
||||
Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding
|
||||
Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information
|
||||
in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)</li>
|
||||
</ul>
|
||||
|
||||
<h4>
|
||||
<a name="section5"></a>5. Combined Libraries.</h4>
|
||||
|
||||
<p>
|
||||
You may place library facilities that are a work based on the Library side by side in a single library together
|
||||
with other library facilities that are not Applications and are not covered by this License, and convey such a
|
||||
combined library under terms of your choice, if you do both of the following:
|
||||
</p>
|
||||
<ul>
|
||||
<li>a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other
|
||||
library facilities, conveyed under the terms of this License.</li>
|
||||
<li>b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.</li>
|
||||
</ul>
|
||||
|
||||
<h4>
|
||||
<a name="section6"></a>6. Revised Versions of the GNU Lesser General Public License.</h4>
|
||||
|
||||
<p>
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License
|
||||
from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail
|
||||
to address new problems or concerns.
|
||||
</p>
|
||||
<p>
|
||||
Each version is given a distinguishing version number. If the Library as you received it specifies that a certain
|
||||
numbered version of the GNU Lesser General Public License “or any later version” applies to it, you
|
||||
have the option of following the terms and conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you received it does not specify a version number
|
||||
of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License
|
||||
ever published by the Free Software Foundation.
|
||||
</p>
|
||||
<p>
|
||||
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser
|
||||
General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization
|
||||
for you to choose that version for the Library.
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
|
||||
<center style="margin-left: -0.4in;">
|
||||
<a href="http://sourceforge.net/projects/astyle">
|
||||
<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2319&type=16" alt="" /></a>
|
||||
</center>
|
||||
|
||||
<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 -->
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
396
doc/news.html
Normal file
396
doc/news.html
Normal file
@ -0,0 +1,396 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<title>Artistic Style - News</title>
|
||||
<meta http-equiv="Content-Language" content="en-us" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
|
||||
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
|
||||
<link href="styles.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Artistic Style News</h1>
|
||||
|
||||
<p>
|
||||
|
||||
</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
|
||||
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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<p>
|
||||
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>
|
||||
<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>
|
||||
<p>
|
||||
A new <a href="http://www.visualstudio.com/news/vs2013-community-vs" target="astyle" 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">
|
||||
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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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 '*'
|
||||
for comment lines is not as useful as it once was. The current trend is toward code that is easier to maintain.
|
||||
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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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
|
||||
Style library (ASTYLE_LIB) build contains such exports which causes an import library and export file to be created
|
||||
when they may not be needed. A new preprocessor definition, ASTYLE_NO_VCX (no Visual Studio exports) can be declared
|
||||
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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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
|
||||
such Jython can be added. It can be easily switched between Python versions or different interpreters. But the
|
||||
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>
|
||||
<p>
|
||||
Thanks to Christopher Sean Morrison, Keith OHara, louis6g, and J for their contributions.
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
<strong>Previous releases are available in the <a href="http://astyle.sourceforge.net/newsArchives.html">News Archives</a>.</strong>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
|
||||
<center style="margin-left: -0.4in;">
|
||||
<a href="http://sourceforge.net/projects/astyle">
|
||||
<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2319&type=16" alt="" /></a>
|
||||
</center>
|
||||
|
||||
<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 -->
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
282
doc/notes.html
Normal file
282
doc/notes.html
Normal file
@ -0,0 +1,282 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<title>Artistic Style - Release Notes</title>
|
||||
<meta http-equiv="Content-Language" content="en-us" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
|
||||
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
|
||||
<link href="styles.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Artistic Style Release Notes</h1>
|
||||
|
||||
<p>
|
||||
|
||||
</p>
|
||||
|
||||
<h3>Artistic Style 2.05.1 (December 2014)</h3>
|
||||
|
||||
<ul>
|
||||
<li>Fix incorrectly reporting files containing disabled formatting as being formatted.</li>
|
||||
<li>Fix incorrect handling of quoted arguments in the options file (#321).</li>
|
||||
<li>Fix error in identifying an enum return type as an enumeration (#322, 323).</li>
|
||||
<li>Fix error in identifying an enum argument as an enumeration (#327).</li>
|
||||
<li>Fix recognition of Qt keywords when used as variables in C++ (#329).</li>
|
||||
<li>Fix recognition of a pointer in a C++ cast (#316).</li>
|
||||
<li>Fix removing trailing whitespace after a changed pointer or reference cast.</li>
|
||||
</ul>
|
||||
|
||||
<h3>Artistic Style 2.05 (November 2014)</h3>
|
||||
|
||||
<ul>
|
||||
<li>Add new bracket style option "style=vtk" (#155).</li>
|
||||
<li>Add new option "indent-preproc-block" to indent blocks of preprocessor directives (#21, #114, #229,
|
||||
#242, #294).</li>
|
||||
<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
|
||||
(#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>
|
||||
<li>Remove option "style=ansi" and make it depreciated (#146).</li>
|
||||
<li>Remove fix for broken 'case' statements from release 2.02.1, Nov 21, 2011.</li>
|
||||
<li>Improve Korean translation (#256).</li>
|
||||
<li>Change shared libraries to include the version number as part of the file name (#264)</li>
|
||||
<li>Change "help" display to stdout to allow piping and redirection (#63).</li>
|
||||
<li>Change "version" display to stdout. </li>
|
||||
<li>Change headers to include foreach, forever, Q_FOREACH, and Q_FOREVER (#98, #154).</li>
|
||||
<li>Change compiler definition ASTYLE_NO_VCX (no Visual Studio exports) to ASTYLE_NO_EXPORTS.</li>
|
||||
<li>Change shared library error handler argument from "char*" to "const char*".</li>
|
||||
<li>Fix not recognizing noexcept, interrupt, and autoreleasepool as pre-command headers (#225, #259).</li>
|
||||
<li>Fix formatting of C++11 uniform initializer brackets (#253, #257, #260, #284).</li>
|
||||
<li>Fix to not automatically space pad C++11 uniform initializer brackets (#275).</li>
|
||||
<li>Fix formatting of enums with leading commas (#159, #179, #270).</li>
|
||||
<li>Fix formatting of logical && operator in class initializers (#290).</li>
|
||||
<li>Fix flagging a 'const' variable as a 'const' method (#275).</li>
|
||||
<li>Fix piping and redirection adding an extra character to the output (#245, #252, #305). </li>
|
||||
<li>Fix "indent-modifiers" to attach class access modifiers to Horstmann style brackets. </li>
|
||||
<li>Fix ASFormatter to correctly recognize the end of a C++ raw string literal (#261).</li>
|
||||
<li>Fix to recognize C++11 "enum class" as an enum (#303).</li>
|
||||
<li>Fix indent of C++11 "noexecpt" statements within a class (#260, #304).</li>
|
||||
<li>Fix not resetting templateDepth when a template was not found (#295).</li>
|
||||
<li>Fix formatting of multiplication in a block paren (#144).</li>
|
||||
<li>Fix whitespace padding when formatting an rvalue references (#297).</li>
|
||||
<li>Fix to recognize an rvalue reference without a name (#265).</li>
|
||||
<li>Fix to not identify an operator overload method as a calculation (#296).</li>
|
||||
<li>Fix concatenating multiplication with a pointer dereference (#291).</li>
|
||||
<li>Fix recognition of a pointer dereference following a question mark (#213).</li>
|
||||
<li>Fix extra space after a trailing reference type (#300).</li>
|
||||
<li>Fix _asm blocks not being identified as a block opener and the variable not cleared on exit (#163).</li>
|
||||
<li>Fix indentation of line comments before a "class" opening bracket.</li>
|
||||
<li>Fix indentation of line comments before a "namespace" opening bracket.</li>
|
||||
<li>Fix isBracketType() method to correctly process a NULL_TYPE.</li>
|
||||
<li>Fix unpad-paren to recognize additional variables (#43, #132, #143). </li>
|
||||
<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::
|
||||
<ul>
|
||||
<li>Extract class Utf8_16 from ASConsole. </li>
|
||||
<li>Replace Linux dependency on iconv with a Utf8_16 class for ASLibrary.</li>
|
||||
<li>Move global "using" statements to the astyle namespace in astyle.h and ASLocalizer.h. </li>
|
||||
<li>Move shared library declarations from astyle.h to astyle_main.h.</li>
|
||||
<li>Move indentable macros from ASEnhancer to ASResource and create static pairs.</li>
|
||||
<li>Simplify ASBeautifier procedure to identify the colon (:) type.</li>
|
||||
<li>Major refactoring in ASBeautifier to create separate variables for an enum, a class statement and a class initializer.<br />
|
||||
This was needed to fix the processing of C++11 uniform initializers in a class initializer.
|
||||
</li>
|
||||
<li>Minor changes to ASFormatter and ASBeautifier based on results of the Clang analyzer. </li>
|
||||
<li>Change several methods in astyle_main to "const".</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Artistic Style 2.04 (November 2013)</h3>
|
||||
|
||||
<ul>
|
||||
<li>Add new programming language Objective‑C.</li>
|
||||
<li>Add new bracket style option "style=google" (-A14). </li>
|
||||
<li>Add new option "indent-preproc-cond" (xw) to indent preprocessor conditional statements (#118). </li>
|
||||
<li>Add new bracket modify options "attach-namespaces", "attach-classes", "attach-inlines", and "attach-extern-c".
|
||||
</li>
|
||||
<li>Add new option "indent-modifiers" (-xG) to indent class access modifiers one-half indent (#130). </li>
|
||||
<li>Add new option "remove-brackets" (-xj) to remove brackets from single line conditional statements.</li>
|
||||
<li>Add new option "remove-comment-prefix" (-xp) to remove the leading '*' from multi-line comments. </li>
|
||||
<li>Add new option "align-method-colon" (-xM) to align Objective‑C method colons. </li>
|
||||
<li>Add new option "pad-method-colon=#" (-xP#) to space pad Objective‑C method colons. </li>
|
||||
<li>Add new options "pad-method-prefix" (-xQ), and "unpad-method-prefix" (-xR) to pad the Objective‑C "-" and
|
||||
"+" method prefix. </li>
|
||||
<li>Add new dll entry point AStyleMainUtf16 for processing C# UTF-16 strings. </li>
|
||||
<li>Add formatting of C++11 raw string literals (#222). </li>
|
||||
<li>Add "style=knf" as an alternative to "style=linux".</li>
|
||||
<li>Remove depreciated "bracket=" options.</li>
|
||||
<li>Improve recognition and formatting of pointers and references (#174 and other changes). </li>
|
||||
<li>Improve the recognition of block-opening brackets.</li>
|
||||
<li>Improve code using a static code analyzer (#195).</li>
|
||||
<li>Change "max-code-length" to include Objective‑C methods.</li>
|
||||
<li>Change "indent-elseifs" and "break-blocks" to look ahead only if in command-type brackets (speed improvement).
|
||||
</li>
|
||||
<li>Fix linux bracket styles to break the opening bracket in inline function definitions (#185). </li>
|
||||
<li>Fix indentation of switch block comments (#164). </li>
|
||||
<li>Fix enums to indent with tabs when requested (#92, #121). </li>
|
||||
<li>Fix formatting of rvalue reference without a name in a declaration (#219). </li>
|
||||
<li>Fix "pad-first-paren-out" to not pad if the following parens are empty (#232). </li>
|
||||
<li>Fix end-of-statement reset when comments follow closing bracket.</li>
|
||||
<li>Fix the ASBeautifier active and waiting stacks to delete the ASBeautifier objects before deleting the pointers.
|
||||
</li>
|
||||
<li>Fix ASBeautifier "init" to delete the tempStack vectors before deleting the tempStack.</li>
|
||||
<li>Fix Linux piping problem by changing "cin" input to build a stringstream before formatting. </li>
|
||||
<li>Fix to identify the correct bracket type when 'extern "C"' is part of the enum definition. </li>
|
||||
<li>Fix to clear 'extern "C"' variables when the block is closed. </li>
|
||||
<li>Fix unindented 'extern "C"' to not indent when in a #else preprocessor directive.</li>
|
||||
<li>Fix not always correctly formatting linux type brackets for enum blocks.</li>
|
||||
<li>Fix align-pointer in a range-based for statement (#217).</li>
|
||||
<li>Fix pointer-reference argument alignment to correctly position a following comment (#235).</li>
|
||||
<li>Fix to not attach a bracket to a line ending in a backslash '\' (#186, #214, #220). </li>
|
||||
<li>Fix to recognize templates using multiple lines (#85, #87, #136).</li>
|
||||
<li>Fix formatting of template continuation lines (#85, #87, #136).</li>
|
||||
<li>Fix to allow '^' as an array operator (#233). </li>
|
||||
<li>Fix an "enum" argument being mistaken for an enumeration (#211).</li>
|
||||
<li>Fix to recognize a non-instatement array after a "},{" sequence.</li>
|
||||
<li>Fix "pad-oper" to not pad before a following comma. </li>
|
||||
<li>Fix recognition of an operator when the calculation contains a bitwise "not" '~' (#166).</li>
|
||||
<li>Fix to allow a preprocessor statement within a preprocessor define (#238).</li>
|
||||
<li>Fix preprocessor comparison to check for whole words (#246).</li>
|
||||
<li>Fix "add-brackets" when a line contains more than one paren pairs (#181).</li>
|
||||
<li>Fix to allow Mac old CR line endings in the options file (#129).</li>
|
||||
<li>Refactor to aid debugging and improve design and decomposition:
|
||||
<ul>
|
||||
<li>Move ALL preliminary indentation calculations to computePreliminaryIndentation() in ASBeautifier.</li>
|
||||
<li>Move calculation of 'force tab' indents to preLineWS() in ASBeautifier. </li>
|
||||
<li>Combine methods init() and init(ASSourceIterator*) in ASBeautifier.</li>
|
||||
<li>Extract method adjustParsedLineIndentation() in ASBeautifier.</li>
|
||||
<li>Extract method parseCurrentLine() in ASEnhancer. </li>
|
||||
<li>Remove astyle_main.cpp unused functions getFilesUnchanged, getOptionsFileRequired, and setOptionsFileRequired.
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Artistic Style 2.03 (April 2013)</h3>
|
||||
|
||||
<ul>
|
||||
<li>Add new option "indent=force-tab-x=#" (-xT#) to allow a tab length that different from the indent length (3430662).
|
||||
</li>
|
||||
<li>Add new option, "pad-first-paren-out" (xd), to pad only the first paren in a series on the outside (3350356).
|
||||
</li>
|
||||
<li>Add new option "max-code-length=#" (-xC#) to limit the length of code on a line. </li>
|
||||
<li>Add new option "break-after-logical" (-xL) to modify a "max-code-length" line break for conditionals. </li>
|
||||
<li>Add new option "close-templates" (-xy) to close whitespace in the angle brackets ">" of template
|
||||
definitions.</li>
|
||||
<li>Add formatting of C++ rvalue references (&&) using the existing "align-pointer" and "align-reference"
|
||||
options.</li>
|
||||
<li>Add formatting of C++/CLI managed pointers (the "^" character) to the "align-pointer" option.</li>
|
||||
<li>Add translations for Dutch, Finnish, Italian, Japanese, Korean, Polish, Portuguese, Russian, Swedish, and Ukrainian.
|
||||
</li>
|
||||
<li>Remove byte-order-mark from ASLocalizer.cpp.</li>
|
||||
<li>Change the short option for delete-empty-lines from "xd" to "xe".</li>
|
||||
<li>Change the ASTYLE_LIB option to remove __declspec for a Visual C static library when ASTYLE_NO_VCX is also declared.
|
||||
</li>
|
||||
<li>Change to remove any space padding in a pointer to pointer (**).</li>
|
||||
<li>Fix "break-elseifs" to format one-line "if" and "else" statements the same as when the option is not used.
|
||||
</li>
|
||||
<li>Fix "break-elseifs" to break else-if statements when "keep-one-line-statements" also is requested. </li>
|
||||
<li>Fix "break-elseifs" to correctly format comments preceding the else-if. </li>
|
||||
<li>Fix C# not correctly identifying lambda expressions as a command-type bracket.</li>
|
||||
<li>Fix C# preprocessor statements adding extra empty lines when "break-blocks" is used. </li>
|
||||
<li>Fix C# padding "get" and "set" statements that are not headers when "break-blocks" is used. </li>
|
||||
<li>Fix C# to recognize the "#line" statement. </li>
|
||||
<li>Fix C++11 standard for range-based "for" loops (3458402, 3480095). </li>
|
||||
<li>Fix C++11 standard for "enum" with a base type (3458402). </li>
|
||||
<li>Fix C++11 standard for template closing angle brackets (no space required) (3495192). </li>
|
||||
<li>Fix C/C++ keyword 'extern "C"' in a preprocessor causing an extra indent (1514844, 2953388, 2963382, 3093842,
|
||||
<span>3467479)</span>. </li>
|
||||
<li>Fix breaking after a switch "default" statement when "break-elseifs" is used without "keep-one-line-statements"
|
||||
(<span>3559365</span>). </li>
|
||||
<li>Fix in-statement arrays to indent correctly when they exceed the "max-instatement-indent". </li>
|
||||
<li>Fix quote continuation sometimes being processed as a preprocessor directive (3445475).</li>
|
||||
<li>Fix formatting of some conditional statements on a continuation-line.</li>
|
||||
<li>Fix Java formatting of generics with wildcards (3428140).</li>
|
||||
<li>Fix formatting of pointers and references to work with the new "max-code-length" option. </li>
|
||||
<li>Fix formatting of pointers and references after a template close.</li>
|
||||
<li>Fix formatting of empty attached brackets (3505002).</li>
|
||||
<li>Fix C comments beginning a line breaking if they follow a semi-colon (3502700).</li>
|
||||
<li>Fix "pad-header" not padding "return" and "throw" statements (3509134).</li>
|
||||
<li>Fix recognition problems with templates.</li>
|
||||
<li>Fix "struct" return type being mistaken for a struct.</li>
|
||||
<li>Fix "pad-oper" in java for-each loop.</li>
|
||||
<li>Fix recognition of a macro multi-line comment (3414970).</li>
|
||||
<li>Fix bracketTypeStack entries added by #if and #else if the # is separated from the word. </li>
|
||||
<li>Fix C++ breaking a line on an access modifier in a one-line block when "keep-one-line-blocks" is used.
|
||||
</li>
|
||||
<li>Fix memory leak when "ascii" option is used.</li>
|
||||
<li>Fix memory leak when a preprocessor statement is used without a closing #endif.</li>
|
||||
<li>Fix preprocessor directive to allow compiling with mingw-x64 compiler.</li>
|
||||
<li>Fix redirection on Windows so it does not hang when Linux line ends are used (3514712).</li>
|
||||
<li>Fix redirection on Linux to output the correct line ends (3514712).</li>
|
||||
<li>Fix non-portable return value on locale name (3452574). </li>
|
||||
<li>Fix assert errors caused by not checking the text length on the return from peekNextText().</li>
|
||||
<li>Fix spelling of "depreciated" in help message (3454735).</li>
|
||||
<li>Refactor to improve design and decomposition:
|
||||
<ul>
|
||||
<li>Fix warning messages from Visual Studio static code analysis.</li>
|
||||
<li>Fix warning messages from cppcheck, except for constructor uninitialized variables (false positive). </li>
|
||||
<li>Remove astyle_main.h dependency from ASLocalizer.h </li>
|
||||
<li>Remove appendChar() from the inline functions.</li>
|
||||
<li>Extract methods for pointer or reference alignment in ASFormatter. </li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
<strong>Previous releases are available in the <a href="http://astyle.sourceforge.net/notesArchives.html">Release
|
||||
Notes Archives</a>.</strong>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
|
||||
<center style="margin-left: -0.4in;">
|
||||
<a href="http://sourceforge.net/projects/astyle">
|
||||
<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2319&type=16" alt="" /></a>
|
||||
</center>
|
||||
|
||||
<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 -->
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
39
doc/styles.css
Normal file
39
doc/styles.css
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
/* h1 is a title
|
||||
* h2 is a subtitle
|
||||
* h3 is a hanging text title
|
||||
* h4 is a non-hanging text title
|
||||
* p.noindent is non-hanging text (text without a title)
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
body { background-color: white; margin-top: 0.5in; margin-right: 0.8in; margin-bottom: 0.5in; margin-left: 1.3in; }
|
||||
|
||||
h1 { color: #0000A0; text-align: center; font-style: italic; margin-top: 18pt; margin-left: -0.5in; }
|
||||
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; }
|
||||
|
||||
p.noindent { margin-left: -0.4in; }
|
||||
p.contents1 { font-size: 105%; margin-top: 0in; margin-left: 0in; margin-bottom: 0in; margin-right: 0in; }
|
||||
p.contents2 { margin-top: 0in; margin-left: .4in; margin-bottom: 0in; margin-right: .4in; }
|
||||
/* p.contents3 { margin-top:0in; margin-left:.8in; margin-bottom:0in; margin-right:.8in; } */
|
||||
a.contents:link, a.contents:visited { color: #0000A0; text-decoration: none; }
|
||||
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; }
|
199
makefile/clang/Makefile
Normal file
199
makefile/clang/Makefile
Normal file
@ -0,0 +1,199 @@
|
||||
# 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
|
||||
SRC = astyle_main.cpp \
|
||||
ASBeautifier.cpp \
|
||||
ASFormatter.cpp \
|
||||
ASEnhancer.cpp \
|
||||
ASLocalizer.cpp \
|
||||
ASResource.cpp
|
||||
|
||||
# source directories
|
||||
vpath %.cpp ../../src
|
||||
vpath %.h ../../src
|
||||
|
||||
# NOTE for java compiles the environment variable $JAVA_HOME must be set
|
||||
# example: export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.00
|
||||
ifndef JAVA_HOME
|
||||
JAVA_HOME = /usr/lib/jvm/default-java
|
||||
endif
|
||||
|
||||
# set prefix if not defined on the command line
|
||||
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
|
||||
JAVAINCS = -I$(JAVA_HOME)/include
|
||||
CXX = clang++
|
||||
INSTALL=install -o $(USER) -g $(USER)
|
||||
|
||||
##################################################
|
||||
|
||||
# define compile options for each build
|
||||
ifdef CFLAGS
|
||||
CFLAGSr = -DNDEBUG $(CBASEFLAGS) $(CFLAGS)
|
||||
CFLAGSd = -g $(CBASEFLAGS) $(CFLAGS)
|
||||
else
|
||||
CFLAGSr = -DNDEBUG -O3 $(CBASEFLAGS)
|
||||
CFLAGSd = -g $(CBASEFLAGS)
|
||||
endif
|
||||
CFLAGSs = -DASTYLE_LIB -fPIC -fvisibility=hidden $(CFLAGSr)
|
||||
CFLAGSsd = -DASTYLE_LIB -fPIC -fvisibility=hidden $(CFLAGSd)
|
||||
CFLAGSa = -DASTYLE_LIB $(CFLAGSr)
|
||||
CFLAGSad = -DASTYLE_LIB $(CFLAGSd)
|
||||
CFLAGSsj = -DASTYLE_JNI -fPIC -fvisibility=hidden $(CFLAGSr) $(JAVAINCS)
|
||||
CFLAGSsjd = -DASTYLE_JNI -fPIC -fvisibility=hidden $(CFLAGSd) $(JAVAINCS)
|
||||
|
||||
# define link options
|
||||
ifdef LDFLAGS
|
||||
LDFLAGSr = $(LDFLAGS)
|
||||
LDFLAGSd = $(LDFLAGS)
|
||||
else
|
||||
LDFLAGSr = -s
|
||||
LDFLAGSd =
|
||||
endif
|
||||
|
||||
# object files are built from the source list $(SRC)
|
||||
# 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))
|
||||
|
||||
# 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 $@ $<
|
||||
|
||||
# OBJd
|
||||
$(objdir)/%_d.o: %.cpp astyle.h astyle_main.h
|
||||
@ mkdir -p $(objdir)
|
||||
$(CXX) $(CFLAGSd) -c -o $@ $<
|
||||
|
||||
# OBJs
|
||||
$(objdir)/%_s.o: %.cpp astyle.h
|
||||
@ mkdir -p $(objdir)
|
||||
$(CXX) $(CFLAGSs) -c -o $@ $<
|
||||
|
||||
# OBJsd
|
||||
$(objdir)/%_sd.o: %.cpp astyle.h
|
||||
@ mkdir -p $(objdir)
|
||||
$(CXX) $(CFLAGSsd) -c -o $@ $<
|
||||
|
||||
# OBJa
|
||||
$(objdir)/%_a.o: %.cpp astyle.h
|
||||
@ mkdir -p $(objdir)
|
||||
$(CXX) $(CFLAGSa) -c -o $@ $<
|
||||
|
||||
# OBJad
|
||||
$(objdir)/%_ad.o: %.cpp astyle.h
|
||||
@ mkdir -p $(objdir)
|
||||
$(CXX) $(CFLAGSad) -c -o $@ $<
|
||||
|
||||
# OBJsj
|
||||
$(objdir)/%_sj.o: %.cpp astyle.h
|
||||
@ mkdir -p $(objdir)
|
||||
$(CXX) $(CFLAGSsj) -c -o $@ $<
|
||||
|
||||
# OBJsjd
|
||||
$(objdir)/%_sjd.o: %.cpp astyle.h
|
||||
@ mkdir -p $(objdir)
|
||||
$(CXX) $(CFLAGSsjd) -c -o $@ $<
|
||||
|
||||
##################################################
|
||||
# define build dependencies for each command
|
||||
|
||||
release: astyle
|
||||
astyle: $(OBJ)
|
||||
@ mkdir -p $(bindir)
|
||||
$(CXX) $(LDFLAGSr) -o $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
debug: astyled
|
||||
astyled: $(OBJd)
|
||||
@ mkdir -p $(bindir)
|
||||
$(CXX) $(LDFLAGSd) -o $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
shared: libastyle-2.05.1.so
|
||||
libastyle-2.05.1.so: $(OBJs)
|
||||
@ mkdir -p $(bindir)
|
||||
$(CXX) -shared $(LDFLAGSr) -o $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
shareddebug: libastyle-2.05.1d.so
|
||||
libastyle-2.05.1d.so: $(OBJsd)
|
||||
@ mkdir -p $(bindir)
|
||||
$(CXX) -shared $(LDFLAGSd) -o $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
static: libastyle.a
|
||||
libastyle.a: $(OBJa)
|
||||
@ mkdir -p $(bindir)
|
||||
ar crs $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
staticdebug: libastyled.a
|
||||
libastyled.a: $(OBJad)
|
||||
@ mkdir -p $(bindir)
|
||||
ar crs $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
java: libastyle-2.05.1j.so
|
||||
libastyle-2.05.1j.so: $(OBJsj)
|
||||
@ mkdir -p $(bindir)
|
||||
$(CXX) -shared $(LDFLAGSr) -o $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
javadebug: libastyle-2.05.1jd.so
|
||||
libastyle-2.05.1jd.so: $(OBJsjd)
|
||||
@ mkdir -p $(bindir)
|
||||
$(CXX) -shared $(LDFLAGSd) -o $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
all: release debug shared shareddebug static staticdebug
|
||||
|
||||
javaall: java javadebug
|
||||
|
||||
clean:
|
||||
rm -f $(objdir)/*.o $(bindir)/*astyle*
|
||||
|
||||
cleanobj:
|
||||
rm -f $(objdir)/*.o
|
||||
|
||||
install:
|
||||
$(INSTALL) -m 755 -d $(ipath)
|
||||
@$(INSTALL) -m 755 $(bindir)/astyle $(ipath)
|
||||
|
||||
$(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
|
199
makefile/gcc/Makefile
Normal file
199
makefile/gcc/Makefile
Normal file
@ -0,0 +1,199 @@
|
||||
# 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
|
||||
SRC = astyle_main.cpp \
|
||||
ASBeautifier.cpp \
|
||||
ASFormatter.cpp \
|
||||
ASEnhancer.cpp \
|
||||
ASLocalizer.cpp \
|
||||
ASResource.cpp
|
||||
|
||||
# source directories
|
||||
vpath %.cpp ../../src
|
||||
vpath %.h ../../src
|
||||
|
||||
# NOTE for java compiles the environment variable $JAVA_HOME must be set
|
||||
# example: export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.00
|
||||
ifndef JAVA_HOME
|
||||
JAVA_HOME = /usr/lib/jvm/default-java
|
||||
endif
|
||||
|
||||
# set prefix if not defined on the command line
|
||||
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
|
||||
JAVAINCS = -I$(JAVA_HOME)/include
|
||||
CXX = g++
|
||||
INSTALL=install -o $(USER) -g $(USER)
|
||||
|
||||
##################################################
|
||||
|
||||
# define compile options for each build
|
||||
ifdef CFLAGS
|
||||
CFLAGSr = -DNDEBUG $(CBASEFLAGS) $(CFLAGS)
|
||||
CFLAGSd = -g $(CBASEFLAGS) $(CFLAGS)
|
||||
else
|
||||
CFLAGSr = -DNDEBUG -O3 $(CBASEFLAGS)
|
||||
CFLAGSd = -g $(CBASEFLAGS)
|
||||
endif
|
||||
CFLAGSs = -DASTYLE_LIB -fPIC -fvisibility=hidden $(CFLAGSr)
|
||||
CFLAGSsd = -DASTYLE_LIB -fPIC -fvisibility=hidden $(CFLAGSd)
|
||||
CFLAGSa = -DASTYLE_LIB $(CFLAGSr)
|
||||
CFLAGSad = -DASTYLE_LIB $(CFLAGSd)
|
||||
CFLAGSsj = -DASTYLE_JNI -fPIC -fvisibility=hidden $(CFLAGSr) $(JAVAINCS)
|
||||
CFLAGSsjd = -DASTYLE_JNI -fPIC -fvisibility=hidden $(CFLAGSd) $(JAVAINCS)
|
||||
|
||||
# define link options
|
||||
ifdef LDFLAGS
|
||||
LDFLAGSr = $(LDFLAGS)
|
||||
LDFLAGSd = $(LDFLAGS)
|
||||
else
|
||||
LDFLAGSr = -s
|
||||
LDFLAGSd =
|
||||
endif
|
||||
|
||||
# object files are built from the source list $(SRC)
|
||||
# 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))
|
||||
|
||||
# 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 $@ $<
|
||||
|
||||
# OBJd
|
||||
$(objdir)/%_d.o: %.cpp astyle.h astyle_main.h
|
||||
@ mkdir -p $(objdir)
|
||||
$(CXX) $(CFLAGSd) -c -o $@ $<
|
||||
|
||||
# OBJs
|
||||
$(objdir)/%_s.o: %.cpp astyle.h
|
||||
@ mkdir -p $(objdir)
|
||||
$(CXX) $(CFLAGSs) -c -o $@ $<
|
||||
|
||||
# OBJsd
|
||||
$(objdir)/%_sd.o: %.cpp astyle.h
|
||||
@ mkdir -p $(objdir)
|
||||
$(CXX) $(CFLAGSsd) -c -o $@ $<
|
||||
|
||||
# OBJa
|
||||
$(objdir)/%_a.o: %.cpp astyle.h
|
||||
@ mkdir -p $(objdir)
|
||||
$(CXX) $(CFLAGSa) -c -o $@ $<
|
||||
|
||||
# OBJad
|
||||
$(objdir)/%_ad.o: %.cpp astyle.h
|
||||
@ mkdir -p $(objdir)
|
||||
$(CXX) $(CFLAGSad) -c -o $@ $<
|
||||
|
||||
# OBJsj
|
||||
$(objdir)/%_sj.o: %.cpp astyle.h
|
||||
@ mkdir -p $(objdir)
|
||||
$(CXX) $(CFLAGSsj) -c -o $@ $<
|
||||
|
||||
# OBJsjd
|
||||
$(objdir)/%_sjd.o: %.cpp astyle.h
|
||||
@ mkdir -p $(objdir)
|
||||
$(CXX) $(CFLAGSsjd) -c -o $@ $<
|
||||
|
||||
##################################################
|
||||
# define build dependencies for each command
|
||||
|
||||
release: astyle
|
||||
astyle: $(OBJ)
|
||||
@ mkdir -p $(bindir)
|
||||
$(CXX) $(LDFLAGSr) -o $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
debug: astyled
|
||||
astyled: $(OBJd)
|
||||
@ mkdir -p $(bindir)
|
||||
$(CXX) $(LDFLAGSd) -o $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
shared: libastyle-2.05.1.so
|
||||
libastyle-2.05.1.so: $(OBJs)
|
||||
@ mkdir -p $(bindir)
|
||||
$(CXX) -shared $(LDFLAGSr) -o $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
shareddebug: libastyle-2.05.1d.so
|
||||
libastyle-2.05.1d.so: $(OBJsd)
|
||||
@ mkdir -p $(bindir)
|
||||
$(CXX) -shared $(LDFLAGSd) -o $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
static: libastyle.a
|
||||
libastyle.a: $(OBJa)
|
||||
@ mkdir -p $(bindir)
|
||||
ar crs $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
staticdebug: libastyled.a
|
||||
libastyled.a: $(OBJad)
|
||||
@ mkdir -p $(bindir)
|
||||
ar crs $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
java: libastyle-2.05.1j.so
|
||||
libastyle-2.05.1j.so: $(OBJsj)
|
||||
@ mkdir -p $(bindir)
|
||||
$(CXX) -shared $(LDFLAGSr) -o $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
javadebug: libastyle-2.05.1jd.so
|
||||
libastyle-2.05.1jd.so: $(OBJsjd)
|
||||
@ mkdir -p $(bindir)
|
||||
$(CXX) -shared $(LDFLAGSd) -o $(bindir)/$@ $^
|
||||
@ echo
|
||||
|
||||
all: release debug shared shareddebug static staticdebug
|
||||
|
||||
javaall: java javadebug
|
||||
|
||||
clean:
|
||||
rm -f $(objdir)/*.o $(bindir)/*astyle*
|
||||
|
||||
cleanobj:
|
||||
rm -f $(objdir)/*.o
|
||||
|
||||
install:
|
||||
$(INSTALL) -m 755 -d $(ipath)
|
||||
@$(INSTALL) -m 755 $(bindir)/astyle $(ipath)
|
||||
|
||||
$(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
|
3481
src/ASBeautifier.cpp
Normal file
3481
src/ASBeautifier.cpp
Normal file
File diff suppressed because it is too large
Load Diff
804
src/ASEnhancer.cpp
Normal file
804
src/ASEnhancer.cpp
Normal file
@ -0,0 +1,804 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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/>.
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*/
|
||||
|
||||
#include "astyle.h"
|
||||
|
||||
|
||||
namespace astyle {
|
||||
|
||||
/**
|
||||
* ASEnhancer constructor
|
||||
*/
|
||||
ASEnhancer::ASEnhancer()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor of ASEnhancer
|
||||
*/
|
||||
ASEnhancer::~ASEnhancer()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* initialize the ASEnhancer.
|
||||
*
|
||||
* init() is called each time an ASFormatter object is initialized.
|
||||
*/
|
||||
void ASEnhancer::init(int _fileType,
|
||||
int _indentLength,
|
||||
int _tabLength,
|
||||
bool _useTabs,
|
||||
bool _forceTab,
|
||||
bool _namespaceIndent,
|
||||
bool _caseIndent,
|
||||
bool _preprocBlockIndent,
|
||||
bool _preprocDefineIndent,
|
||||
bool _emptyLineFill,
|
||||
vector<const pair<const string, const string>* >* _indentableMacros)
|
||||
{
|
||||
// formatting variables from ASFormatter and ASBeautifier
|
||||
ASBase::init(_fileType);
|
||||
indentLength = _indentLength;
|
||||
tabLength = _tabLength;
|
||||
useTabs = _useTabs;
|
||||
forceTab = _forceTab;
|
||||
namespaceIndent = _namespaceIndent;
|
||||
caseIndent = _caseIndent;
|
||||
preprocBlockIndent = _preprocBlockIndent;
|
||||
preprocDefineIndent = _preprocDefineIndent;
|
||||
emptyLineFill = _emptyLineFill;
|
||||
indentableMacros = _indentableMacros;
|
||||
quoteChar = '\'';
|
||||
|
||||
// unindent variables
|
||||
lineNumber = 0;
|
||||
bracketCount = 0;
|
||||
isInComment = false;
|
||||
isInQuote = false;
|
||||
switchDepth = 0;
|
||||
eventPreprocDepth = 0;
|
||||
lookingForCaseBracket = false;
|
||||
unindentNextLine = false;
|
||||
shouldUnindentLine = false;
|
||||
shouldUnindentComment = false;
|
||||
|
||||
// switch struct and vector
|
||||
sw.switchBracketCount = 0;
|
||||
sw.unindentDepth = 0;
|
||||
sw.unindentCase = false;
|
||||
switchStack.clear();
|
||||
|
||||
// other variables
|
||||
nextLineIsEventIndent = false;
|
||||
isInEventTable = false;
|
||||
nextLineIsDeclareIndent = false;
|
||||
isInDeclareSection = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* additional formatting for line of source code.
|
||||
* every line of source code in a source code file should be sent
|
||||
* one after the other to this function.
|
||||
* indents event tables
|
||||
* unindents the case blocks
|
||||
*
|
||||
* @param line the original formatted line will be updated if necessary.
|
||||
*/
|
||||
void ASEnhancer::enhance(string &line, bool isInNamespace, bool isInPreprocessor, bool isInSQL)
|
||||
{
|
||||
shouldUnindentLine = true;
|
||||
shouldUnindentComment = false;
|
||||
lineNumber++;
|
||||
|
||||
// check for beginning of event table
|
||||
if (nextLineIsEventIndent)
|
||||
{
|
||||
isInEventTable = true;
|
||||
nextLineIsEventIndent = false;
|
||||
}
|
||||
|
||||
// check for beginning of SQL declare section
|
||||
if (nextLineIsDeclareIndent)
|
||||
{
|
||||
isInDeclareSection = true;
|
||||
nextLineIsDeclareIndent = false;
|
||||
}
|
||||
|
||||
if (line.length() == 0
|
||||
&& !isInEventTable
|
||||
&& !isInDeclareSection
|
||||
&& !emptyLineFill)
|
||||
return;
|
||||
|
||||
// test for unindent on attached brackets
|
||||
if (unindentNextLine)
|
||||
{
|
||||
sw.unindentDepth++;
|
||||
sw.unindentCase = true;
|
||||
unindentNextLine = false;
|
||||
}
|
||||
|
||||
// parse characters in the current line
|
||||
parseCurrentLine(line, isInPreprocessor, isInSQL);
|
||||
|
||||
// check for SQL indentable lines
|
||||
if (isInDeclareSection)
|
||||
{
|
||||
size_t firstText = line.find_first_not_of(" \t");
|
||||
if (firstText == string::npos || line[firstText] != '#')
|
||||
indentLine(line, 1);
|
||||
}
|
||||
|
||||
// check for event table indentable lines
|
||||
if (isInEventTable
|
||||
&& (eventPreprocDepth == 0
|
||||
|| (namespaceIndent && isInNamespace)))
|
||||
{
|
||||
size_t firstText = line.find_first_not_of(" \t");
|
||||
if (firstText == string::npos || line[firstText] != '#')
|
||||
indentLine(line, 1);
|
||||
}
|
||||
|
||||
if (shouldUnindentComment && sw.unindentDepth > 0)
|
||||
unindentLine(line, sw.unindentDepth - 1);
|
||||
else if (shouldUnindentLine && sw.unindentDepth > 0)
|
||||
unindentLine(line, sw.unindentDepth);
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a force-tab indent to spaces
|
||||
*
|
||||
* @param line a reference to the line that will be converted.
|
||||
*/
|
||||
void ASEnhancer::convertForceTabIndentToSpaces(string &line) const
|
||||
{
|
||||
// replace tab indents with spaces
|
||||
for (size_t i = 0; i < line.length(); i++)
|
||||
{
|
||||
if (!isWhiteSpace(line[i]))
|
||||
break;
|
||||
if (line[i] == '\t')
|
||||
{
|
||||
line.erase(i, 1);
|
||||
line.insert(i, tabLength, ' ');
|
||||
i += tabLength - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a space indent to force-tab
|
||||
*
|
||||
* @param line a reference to the line that will be converted.
|
||||
*/
|
||||
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');
|
||||
}
|
||||
|
||||
/**
|
||||
* find the colon following a 'case' statement
|
||||
*
|
||||
* @param line a reference to the line.
|
||||
* @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 i = caseIndex;
|
||||
bool isInQuote_ = false;
|
||||
char quoteChar_ = ' ';
|
||||
for (; i < line.length(); i++)
|
||||
{
|
||||
if (isInQuote_)
|
||||
{
|
||||
if (line[i] == '\\')
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
else if (line[i] == quoteChar_) // check ending quote
|
||||
{
|
||||
isInQuote_ = false;
|
||||
quoteChar_ = ' ';
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue; // must close quote before continuing
|
||||
}
|
||||
}
|
||||
if (line[i] == '\'' || line[i] == '\"') // check opening quote
|
||||
{
|
||||
isInQuote_ = true;
|
||||
quoteChar_ = line[i];
|
||||
continue;
|
||||
}
|
||||
if (line[i] == ':')
|
||||
{
|
||||
if ((i + 1 < line.length()) && (line[i + 1] == ':'))
|
||||
i++; // bypass scope resolution operator
|
||||
else
|
||||
break; // found it
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* indent a line by a given number of tabsets
|
||||
* by inserting leading whitespace to the line argument.
|
||||
*
|
||||
* @param line a reference to the line to indent.
|
||||
* @param indent the number of tabsets to insert.
|
||||
* @return the number of characters inserted.
|
||||
*/
|
||||
int ASEnhancer::indentLine(string &line, int indent) const
|
||||
{
|
||||
if (line.length() == 0
|
||||
&& !emptyLineFill)
|
||||
return 0;
|
||||
|
||||
size_t charsToInsert;
|
||||
|
||||
if (forceTab && indentLength != tabLength)
|
||||
{
|
||||
// replace tab indents with spaces
|
||||
convertForceTabIndentToSpaces(line);
|
||||
// insert the space indents
|
||||
charsToInsert = indent * indentLength;
|
||||
line.insert(0U, charsToInsert, ' ');
|
||||
// replace leading spaces with tab indents
|
||||
convertSpaceIndentToForceTab(line);
|
||||
}
|
||||
else if (useTabs)
|
||||
{
|
||||
charsToInsert = indent;
|
||||
line.insert(0U, charsToInsert, '\t');
|
||||
}
|
||||
else // spaces
|
||||
{
|
||||
charsToInsert = indent * indentLength;
|
||||
line.insert(0U, charsToInsert, ' ');
|
||||
}
|
||||
|
||||
return charsToInsert;
|
||||
}
|
||||
|
||||
/**
|
||||
* check for SQL "BEGIN DECLARE SECTION".
|
||||
* must compare case insensitive and allow any spacing between words.
|
||||
*
|
||||
* @param line a reference to the line to indent.
|
||||
* @param index the current line index.
|
||||
* @return true if a hit.
|
||||
*/
|
||||
bool ASEnhancer::isBeginDeclareSectionSQL(string &line, size_t index) const
|
||||
{
|
||||
string word;
|
||||
size_t hits = 0;
|
||||
size_t i;
|
||||
for (i = index; i < line.length(); i++)
|
||||
{
|
||||
i = line.find_first_not_of(" \t", i);
|
||||
if (i == string::npos)
|
||||
return false;
|
||||
if (line[i] == ';')
|
||||
break;
|
||||
if (!isCharPotentialHeader(line, i))
|
||||
continue;
|
||||
word = getCurrentWord(line, i);
|
||||
for (size_t j = 0; j < word.length(); j++)
|
||||
word[j] = (char) toupper(word[j]);
|
||||
if (word == "EXEC" || word == "SQL")
|
||||
{
|
||||
i += word.length() - 1;
|
||||
continue;
|
||||
}
|
||||
if (word == "DECLARE" || word == "SECTION")
|
||||
{
|
||||
hits++;
|
||||
i += word.length() - 1;
|
||||
continue;
|
||||
}
|
||||
if (word == "BEGIN")
|
||||
{
|
||||
hits++;
|
||||
i += word.length() - 1;
|
||||
continue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (hits == 3)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* check for SQL "END DECLARE SECTION".
|
||||
* must compare case insensitive and allow any spacing between words.
|
||||
*
|
||||
* @param line a reference to the line to indent.
|
||||
* @param index the current line index.
|
||||
* @return true if a hit.
|
||||
*/
|
||||
bool ASEnhancer::isEndDeclareSectionSQL(string &line, size_t index) const
|
||||
{
|
||||
string word;
|
||||
size_t hits = 0;
|
||||
size_t i;
|
||||
for (i = index; i < line.length(); i++)
|
||||
{
|
||||
i = line.find_first_not_of(" \t", i);
|
||||
if (i == string::npos)
|
||||
return false;
|
||||
if (line[i] == ';')
|
||||
break;
|
||||
if (!isCharPotentialHeader(line, i))
|
||||
continue;
|
||||
word = getCurrentWord(line, i);
|
||||
for (size_t j = 0; j < word.length(); j++)
|
||||
word[j] = (char) toupper(word[j]);
|
||||
if (word == "EXEC" || word == "SQL")
|
||||
{
|
||||
i += word.length() - 1;
|
||||
continue;
|
||||
}
|
||||
if (word == "DECLARE" || word == "SECTION")
|
||||
{
|
||||
hits++;
|
||||
i += word.length() - 1;
|
||||
continue;
|
||||
}
|
||||
if (word == "END")
|
||||
{
|
||||
hits++;
|
||||
i += word.length() - 1;
|
||||
continue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (hits == 3)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* check if a one-line bracket has been reached,
|
||||
* i.e. if the currently reached '{' character is closed
|
||||
* with a complimentary '}' elsewhere on the current line,
|
||||
*.
|
||||
* @return false = one-line bracket has not been reached.
|
||||
* true = one-line bracket has been reached.
|
||||
*/
|
||||
bool ASEnhancer::isOneLineBlockReached(string &line, int startChar) const
|
||||
{
|
||||
assert(line[startChar] == '{');
|
||||
|
||||
bool isInComment_ = false;
|
||||
bool isInQuote_ = false;
|
||||
int _bracketCount = 1;
|
||||
int lineLength = line.length();
|
||||
char quoteChar_ = ' ';
|
||||
char ch = ' ';
|
||||
|
||||
for (int i = startChar + 1; i < lineLength; ++i)
|
||||
{
|
||||
ch = line[i];
|
||||
|
||||
if (isInComment_)
|
||||
{
|
||||
if (line.compare(i, 2, "*/") == 0)
|
||||
{
|
||||
isInComment_ = false;
|
||||
++i;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == '\\')
|
||||
{
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isInQuote_)
|
||||
{
|
||||
if (ch == quoteChar_)
|
||||
isInQuote_ = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == '"' || ch == '\'')
|
||||
{
|
||||
isInQuote_ = true;
|
||||
quoteChar_ = ch;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line.compare(i, 2, "//") == 0)
|
||||
break;
|
||||
|
||||
if (line.compare(i, 2, "/*") == 0)
|
||||
{
|
||||
isInComment_ = true;
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch == '{')
|
||||
++_bracketCount;
|
||||
else if (ch == '}')
|
||||
--_bracketCount;
|
||||
|
||||
if (_bracketCount == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* parse characters in the current line to determine if an indent
|
||||
* or unindent is needed.
|
||||
*/
|
||||
void ASEnhancer::parseCurrentLine(string &line, bool isInPreprocessor, bool isInSQL)
|
||||
{
|
||||
bool isSpecialChar = false; // is a backslash escape character
|
||||
|
||||
for (size_t i = 0; i < line.length(); i++)
|
||||
{
|
||||
char ch = line[i];
|
||||
|
||||
// bypass whitespace
|
||||
if (isWhiteSpace(ch))
|
||||
continue;
|
||||
|
||||
// handle special characters (i.e. backslash+character such as \n, \t, ...)
|
||||
if (isSpecialChar)
|
||||
{
|
||||
isSpecialChar = false;
|
||||
continue;
|
||||
}
|
||||
if (!(isInComment) && line.compare(i, 2, "\\\\") == 0)
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!(isInComment) && ch == '\\')
|
||||
{
|
||||
isSpecialChar = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// handle quotes (such as 'x' and "Hello Dolly")
|
||||
if (!isInComment && (ch == '"' || ch == '\''))
|
||||
{
|
||||
if (!isInQuote)
|
||||
{
|
||||
quoteChar = ch;
|
||||
isInQuote = true;
|
||||
}
|
||||
else if (quoteChar == ch)
|
||||
{
|
||||
isInQuote = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (isInQuote)
|
||||
continue;
|
||||
|
||||
// handle comments
|
||||
|
||||
if (!(isInComment) && line.compare(i, 2, "//") == 0)
|
||||
{
|
||||
// check for windows line markers
|
||||
if (line.compare(i + 2, 1, "\xf0") > 0)
|
||||
lineNumber--;
|
||||
// unindent if not in case brackets
|
||||
if (line.find_first_not_of(" \t") == i
|
||||
&& sw.switchBracketCount == 1
|
||||
&& sw.unindentCase)
|
||||
shouldUnindentComment = true;
|
||||
break; // finished with the line
|
||||
}
|
||||
else if (!(isInComment) && line.compare(i, 2, "/*") == 0)
|
||||
{
|
||||
// unindent if not in case brackets
|
||||
if (sw.switchBracketCount == 1 && sw.unindentCase)
|
||||
shouldUnindentComment = true;
|
||||
isInComment = true;
|
||||
size_t commentEnd = line.find("*/", i);
|
||||
if (commentEnd == string::npos)
|
||||
i = line.length() - 1;
|
||||
else
|
||||
i = commentEnd - 1;
|
||||
continue;
|
||||
}
|
||||
else if ((isInComment) && line.compare(i, 2, "*/") == 0)
|
||||
{
|
||||
// unindent if not in case brackets
|
||||
if (sw.switchBracketCount == 1 && sw.unindentCase)
|
||||
shouldUnindentComment = true;
|
||||
isInComment = false;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isInComment)
|
||||
{
|
||||
// unindent if not in case brackets
|
||||
if (sw.switchBracketCount == 1 && sw.unindentCase)
|
||||
shouldUnindentComment = true;
|
||||
size_t commentEnd = line.find("*/", i);
|
||||
if (commentEnd == string::npos)
|
||||
i = line.length() - 1;
|
||||
else
|
||||
i = commentEnd - 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if we have reached this far then we are NOT in a comment or string of special characters
|
||||
|
||||
if (line[i] == '{')
|
||||
bracketCount++;
|
||||
|
||||
if (line[i] == '}')
|
||||
bracketCount--;
|
||||
|
||||
// check for preprocessor within an event table
|
||||
if (isInEventTable && line[i] == '#' && preprocBlockIndent)
|
||||
{
|
||||
string preproc;
|
||||
preproc = line.substr(i + 1);
|
||||
if (preproc.substr(0, 2) == "if") // #if, #ifdef, #ifndef)
|
||||
eventPreprocDepth += 1;
|
||||
if (preproc.substr(0, 5) == "endif" && eventPreprocDepth > 0)
|
||||
eventPreprocDepth -= 1;
|
||||
}
|
||||
|
||||
bool isPotentialKeyword = isCharPotentialHeader(line, i);
|
||||
|
||||
// ---------------- wxWidgets and MFC macros ----------------------------------
|
||||
|
||||
if (isPotentialKeyword)
|
||||
{
|
||||
for (size_t j = 0; j < indentableMacros->size(); j++)
|
||||
{
|
||||
// 'first' is the beginning macro
|
||||
if (findKeyword(line, i, indentableMacros->at(j)->first))
|
||||
{
|
||||
nextLineIsEventIndent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (size_t j = 0; j < indentableMacros->size(); j++)
|
||||
{
|
||||
// 'second' is the ending macro
|
||||
if (findKeyword(line, i, indentableMacros->at(j)->second))
|
||||
{
|
||||
isInEventTable = false;
|
||||
eventPreprocDepth = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- process SQL -----------------------------------------------
|
||||
|
||||
if (isInSQL)
|
||||
{
|
||||
if (isBeginDeclareSectionSQL(line, i))
|
||||
nextLineIsDeclareIndent = true;
|
||||
if (isEndDeclareSectionSQL(line, i))
|
||||
isInDeclareSection = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// ---------------- process switch statements ---------------------------------
|
||||
|
||||
if (isPotentialKeyword && findKeyword(line, i, "switch"))
|
||||
{
|
||||
switchDepth++;
|
||||
switchStack.push_back(sw); // save current variables
|
||||
sw.switchBracketCount = 0;
|
||||
sw.unindentCase = false; // don't clear case until end of switch
|
||||
i += 5; // bypass switch statement
|
||||
continue;
|
||||
}
|
||||
|
||||
// just want unindented case statements from this point
|
||||
|
||||
if (caseIndent
|
||||
|| switchDepth == 0
|
||||
|| (isInPreprocessor && !preprocDefineIndent))
|
||||
{
|
||||
// bypass the entire word
|
||||
if (isPotentialKeyword)
|
||||
{
|
||||
string name = getCurrentWord(line, i);
|
||||
i += name.length() - 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
i = processSwitchBlock(line, i);
|
||||
|
||||
} // end of for loop * end of for loop * end of for loop * end of for loop
|
||||
}
|
||||
|
||||
/**
|
||||
* process the character at the current index in a switch block.
|
||||
*
|
||||
* @param line a reference to the line to indent.
|
||||
* @param index the current line index.
|
||||
* @return the new line index.
|
||||
*/
|
||||
size_t ASEnhancer::processSwitchBlock(string &line, size_t index)
|
||||
{
|
||||
size_t i = index;
|
||||
bool isPotentialKeyword = isCharPotentialHeader(line, i);
|
||||
|
||||
if (line[i] == '{')
|
||||
{
|
||||
sw.switchBracketCount++;
|
||||
if (lookingForCaseBracket) // if 1st after case statement
|
||||
{
|
||||
sw.unindentCase = true; // unindenting this case
|
||||
sw.unindentDepth++;
|
||||
lookingForCaseBracket = false; // not looking now
|
||||
}
|
||||
return i;
|
||||
}
|
||||
lookingForCaseBracket = false; // no opening bracket, don't indent
|
||||
|
||||
if (line[i] == '}')
|
||||
{
|
||||
sw.switchBracketCount--;
|
||||
assert(sw.switchBracketCount <= bracketCount);
|
||||
if (sw.switchBracketCount == 0) // if end of switch statement
|
||||
{
|
||||
int lineUnindent = sw.unindentDepth;
|
||||
if (line.find_first_not_of(" \t") == i
|
||||
&& !switchStack.empty())
|
||||
lineUnindent = switchStack[switchStack.size() - 1].unindentDepth;
|
||||
if (shouldUnindentLine)
|
||||
{
|
||||
if (lineUnindent > 0)
|
||||
i -= unindentLine(line, lineUnindent);
|
||||
shouldUnindentLine = false;
|
||||
}
|
||||
switchDepth--;
|
||||
sw = switchStack.back();
|
||||
switchStack.pop_back();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
if (isPotentialKeyword
|
||||
&& (findKeyword(line, i, "case") || findKeyword(line, i, "default")))
|
||||
{
|
||||
if (sw.unindentCase) // if unindented last case
|
||||
{
|
||||
sw.unindentCase = false; // stop unindenting previous case
|
||||
sw.unindentDepth--;
|
||||
}
|
||||
|
||||
i = findCaseColon(line, i);
|
||||
|
||||
i++;
|
||||
for (; i < line.length(); i++) // bypass whitespace
|
||||
{
|
||||
if (!isWhiteSpace(line[i]))
|
||||
break;
|
||||
}
|
||||
if (i < line.length())
|
||||
{
|
||||
if (line[i] == '{')
|
||||
{
|
||||
bracketCount++;
|
||||
sw.switchBracketCount++;
|
||||
if (!isOneLineBlockReached(line, i))
|
||||
unindentNextLine = true;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
lookingForCaseBracket = true;
|
||||
i--; // need to process this char
|
||||
return i;
|
||||
}
|
||||
if (isPotentialKeyword)
|
||||
{
|
||||
string name = getCurrentWord(line, i); // bypass the entire name
|
||||
i += name.length() - 1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* unindent a line by a given number of tabsets
|
||||
* by erasing the leading whitespace from the line argument.
|
||||
*
|
||||
* @param line a reference to the line to unindent.
|
||||
* @param unindent the number of tabsets to erase.
|
||||
* @return the number of characters erased.
|
||||
*/
|
||||
int ASEnhancer::unindentLine(string &line, int unindent) const
|
||||
{
|
||||
size_t whitespace = line.find_first_not_of(" \t");
|
||||
|
||||
if (whitespace == string::npos) // if line is blank
|
||||
whitespace = line.length(); // must remove padding, if any
|
||||
|
||||
if (whitespace == 0)
|
||||
return 0;
|
||||
|
||||
size_t charsToErase = 0;
|
||||
|
||||
if (forceTab && indentLength != tabLength)
|
||||
{
|
||||
// replace tab indents with spaces
|
||||
convertForceTabIndentToSpaces(line);
|
||||
// remove the space indents
|
||||
size_t spaceIndentLength = line.find_first_not_of(" \t");
|
||||
charsToErase = unindent * indentLength;
|
||||
if (charsToErase <= spaceIndentLength)
|
||||
line.erase(0, charsToErase);
|
||||
else
|
||||
charsToErase = 0;
|
||||
// replace leading spaces with tab indents
|
||||
convertSpaceIndentToForceTab(line);
|
||||
}
|
||||
else if (useTabs)
|
||||
{
|
||||
charsToErase = unindent;
|
||||
if (charsToErase <= whitespace)
|
||||
line.erase(0, charsToErase);
|
||||
else
|
||||
charsToErase = 0;
|
||||
}
|
||||
else // spaces
|
||||
{
|
||||
charsToErase = unindent * indentLength;
|
||||
if (charsToErase <= whitespace)
|
||||
line.erase(0, charsToErase);
|
||||
else
|
||||
charsToErase = 0;
|
||||
}
|
||||
|
||||
return charsToErase;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace astyle
|
6989
src/ASFormatter.cpp
Normal file
6989
src/ASFormatter.cpp
Normal file
File diff suppressed because it is too large
Load Diff
898
src/ASLocalizer.cpp
Normal file
898
src/ASLocalizer.cpp
Normal file
@ -0,0 +1,898 @@
|
||||
//
|
||||
// FILE ENCODING IS UTF-8 WITHOUT A BOM.
|
||||
// русский 中文(简体) 日本 한국의
|
||||
//
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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:
|
||||
*
|
||||
* 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().
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*/
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// headers
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "ASLocalizer.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#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;
|
||||
#endif
|
||||
|
||||
#ifdef __VMS
|
||||
#define __USE_STD_IOSTREAM 1
|
||||
#include <assert>
|
||||
#else
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#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__
|
||||
#pragma warn -8104 // Local Static with constructor dangerous for multi-threaded apps
|
||||
#endif
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
#pragma warning(disable: 383) // value copied to temporary, reference to temporary used
|
||||
#pragma warning(disable: 981) // operands are evaluated in unspecified order
|
||||
#endif
|
||||
|
||||
namespace astyle {
|
||||
|
||||
#ifndef ASTYLE_LIB
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ASLocalizer class methods.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
ASLocalizer::ASLocalizer()
|
||||
// Set the locale information.
|
||||
{
|
||||
// set language default values to english (ascii)
|
||||
// this will be used if a locale or a language cannot be found
|
||||
m_localeName = "UNKNOWN";
|
||||
m_langID = "en";
|
||||
m_lcid = 0;
|
||||
m_subLangID.clear();
|
||||
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
|
||||
{
|
||||
fprintf(stderr, "\n%s\n\n", "Cannot set native locale, reverting to English");
|
||||
setTranslationClass();
|
||||
return;
|
||||
}
|
||||
// set the class variables
|
||||
#ifdef _WIN32
|
||||
size_t lcid = GetUserDefaultLCID();
|
||||
setLanguageFromLCID(lcid);
|
||||
#else
|
||||
setLanguageFromName(localeName);
|
||||
#endif
|
||||
}
|
||||
|
||||
ASLocalizer::~ASLocalizer()
|
||||
// Delete dynamically allocated memory.
|
||||
{
|
||||
delete m_translation;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
struct WinLangCode
|
||||
{
|
||||
size_t winLang;
|
||||
char canonicalLang[3];
|
||||
};
|
||||
|
||||
static WinLangCode wlc[] =
|
||||
// primary language identifier http://msdn.microsoft.com/en-us/library/aa912554.aspx
|
||||
// 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" },
|
||||
};
|
||||
|
||||
void ASLocalizer::setLanguageFromLCID(size_t lcid)
|
||||
// Windows get the language to use from the user locale.
|
||||
// NOTE: GetUserDefaultLocaleName() gets nearly the same name as Linux.
|
||||
// But it needs Windows Vista or higher.
|
||||
// Same with LCIDToLocaleName().
|
||||
{
|
||||
m_lcid = lcid;
|
||||
m_langID = "en"; // default to english
|
||||
|
||||
size_t lang = PRIMARYLANGID(LANGIDFROMLCID(m_lcid));
|
||||
size_t sublang = SUBLANGID(LANGIDFROMLCID(m_lcid));
|
||||
// find language in the wlc table
|
||||
size_t count = sizeof(wlc) / sizeof(wlc[0]);
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
if (wlc[i].winLang == lang)
|
||||
{
|
||||
m_langID = wlc[i].canonicalLang;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (m_langID == "zh")
|
||||
{
|
||||
if (sublang == SUBLANG_CHINESE_SIMPLIFIED || sublang == SUBLANG_CHINESE_SINGAPORE)
|
||||
m_subLangID = "CHS";
|
||||
else
|
||||
m_subLangID = "CHT"; // default
|
||||
}
|
||||
setTranslationClass();
|
||||
}
|
||||
|
||||
#endif // _win32
|
||||
|
||||
string ASLocalizer::getLanguageID() const
|
||||
// Returns the language ID in m_langID.
|
||||
{
|
||||
return m_langID;
|
||||
}
|
||||
|
||||
const Translation* ASLocalizer::getTranslationClass() const
|
||||
// Returns the name of the translation class in m_translation. Used for testing.
|
||||
{
|
||||
assert(m_translation);
|
||||
return m_translation;
|
||||
}
|
||||
|
||||
void ASLocalizer::setLanguageFromName(const char* langID)
|
||||
// Linux set the language to use from the langID.
|
||||
//
|
||||
// the language string has the following form
|
||||
//
|
||||
// lang[_LANG][.encoding][@modifier]
|
||||
//
|
||||
// (see environ(5) in the Open Unix specification)
|
||||
//
|
||||
// where lang is the primary language, LANG is a sublang/territory,
|
||||
// encoding is the charset to use and modifier "allows the user to select
|
||||
// a specific instance of localization data within a single category"
|
||||
//
|
||||
// for example, the following strings are valid:
|
||||
// fr
|
||||
// fr_FR
|
||||
// de_DE.iso88591
|
||||
// de_DE@euro
|
||||
// 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);
|
||||
|
||||
// need the sublang for chinese
|
||||
if (m_langID == "zh" && langStr[LEN_LANG] == '_')
|
||||
{
|
||||
string subLang = langStr.substr(LEN_LANG + 1, LEN_LANG);
|
||||
if (subLang == "CN" || subLang == "SG")
|
||||
m_subLangID = "CHS";
|
||||
else
|
||||
m_subLangID = "CHT"; // default
|
||||
}
|
||||
setTranslationClass();
|
||||
}
|
||||
|
||||
const char* ASLocalizer::settext(const char* textIn) const
|
||||
// Call the settext class and return the value.
|
||||
{
|
||||
assert(m_translation);
|
||||
const string stringIn = textIn;
|
||||
return m_translation->translate(stringIn).c_str();
|
||||
}
|
||||
|
||||
void ASLocalizer::setTranslationClass()
|
||||
// Return the required translation class.
|
||||
// Sets the class variable m_translation from the value of m_langID.
|
||||
// Get the language ID at http://msdn.microsoft.com/en-us/library/ee797784%28v=cs.20%29.aspx
|
||||
{
|
||||
assert(m_langID.length());
|
||||
// delete previously set (--ascii option)
|
||||
if (m_translation)
|
||||
{
|
||||
delete m_translation;
|
||||
m_translation = NULL;
|
||||
}
|
||||
if (m_langID == "zh" && m_subLangID == "CHS")
|
||||
m_translation = new ChineseSimplified;
|
||||
else if (m_langID == "zh" && m_subLangID == "CHT")
|
||||
m_translation = new ChineseTraditional;
|
||||
else if (m_langID == "nl")
|
||||
m_translation = new Dutch;
|
||||
else if (m_langID == "en")
|
||||
m_translation = new English;
|
||||
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 == "hi")
|
||||
m_translation = new Hindi;
|
||||
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 == "pl")
|
||||
m_translation = new Polish;
|
||||
else if (m_langID == "pt")
|
||||
m_translation = new Portuguese;
|
||||
else if (m_langID == "ru")
|
||||
m_translation = new Russian;
|
||||
else if (m_langID == "es")
|
||||
m_translation = new Spanish;
|
||||
else if (m_langID == "sv")
|
||||
m_translation = new Swedish;
|
||||
else if (m_langID == "uk")
|
||||
m_translation = new Ukrainian;
|
||||
else // default
|
||||
m_translation = new English;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Translation base class methods.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
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
|
||||
// Convert wchar_t to a multibyte string using the currently assigned locale.
|
||||
// Return an empty string if an error occurs.
|
||||
{
|
||||
static bool msgDisplayed = false;
|
||||
// get length of the output excluding the NULL and validate the parameters
|
||||
size_t mbLen = wcstombs(NULL, wideStr.c_str(), 0);
|
||||
if (mbLen == string::npos)
|
||||
{
|
||||
if (!msgDisplayed)
|
||||
{
|
||||
fprintf(stderr, "\n%s\n\n", "Cannot convert to multi-byte string, reverting to English");
|
||||
msgDisplayed = true;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
// convert the characters
|
||||
char* mbStr = new(nothrow) char[mbLen + 1];
|
||||
if (mbStr == NULL)
|
||||
{
|
||||
if (!msgDisplayed)
|
||||
{
|
||||
fprintf(stderr, "\n%s\n\n", "Bad memory alloc for multi-byte string, reverting to English");
|
||||
msgDisplayed = true;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
wcstombs(mbStr, wideStr.c_str(), mbLen + 1);
|
||||
// return the string
|
||||
string mbTranslation = mbStr;
|
||||
delete [] mbStr;
|
||||
return mbTranslation;
|
||||
}
|
||||
|
||||
size_t Translation::getTranslationVectorSize() const
|
||||
// Return the translation vector size. Used for testing.
|
||||
{
|
||||
return m_translation.size();
|
||||
}
|
||||
|
||||
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++)
|
||||
{
|
||||
if (m_translation[i].first == stringIn)
|
||||
{
|
||||
wideOut = m_translation[i].second;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// not found
|
||||
wideOut = L"";
|
||||
return false;
|
||||
}
|
||||
|
||||
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.
|
||||
// This allows "settext" to be called from a "const" method.
|
||||
{
|
||||
static string mbTranslation;
|
||||
mbTranslation.clear();
|
||||
for (size_t i = 0; i < m_translation.size(); i++)
|
||||
{
|
||||
if (m_translation[i].first == stringIn)
|
||||
{
|
||||
mbTranslation = convertToMultiByte(m_translation[i].second);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// not found, return english
|
||||
if (mbTranslation.empty())
|
||||
mbTranslation = stringIn;
|
||||
return mbTranslation;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Translation class methods.
|
||||
// These classes have only a constructor which builds the language vector.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
ChineseSimplified::ChineseSimplified() // 中文(简体)
|
||||
{
|
||||
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(" 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 已经终止运行");
|
||||
}
|
||||
|
||||
ChineseTraditional::ChineseTraditional() // 中文(繁體)
|
||||
{
|
||||
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(" 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 已經終止運行");
|
||||
}
|
||||
|
||||
Dutch::Dutch() // Nederlandse
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Geformatteerd %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Onveranderd %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"Directory %s\n");
|
||||
addPair("Exclude %s\n", L"Uitsluiten %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Uitgesloten (ongeëvenaarde) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s geformatteerd %s onveranderd ");
|
||||
addPair(" seconds ", L" seconden ");
|
||||
addPair("%d min %d sec ", L"%d min %d sec ");
|
||||
addPair("%s lines\n", L"%s lijnen\n");
|
||||
addPair("Using default options file %s\n", L"Met behulp van standaard opties bestand %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Het openen van HTML-documentatie %s\n");
|
||||
addPair("Invalid option file options:", L"Ongeldige optie file opties:");
|
||||
addPair("Invalid command line options:", L"Ongeldige command line opties:");
|
||||
addPair("For help on options type 'astyle -h'", L"Voor hulp bij 'astyle-h' opties het type");
|
||||
addPair("Cannot open options file", L"Kan niet worden geopend options bestand");
|
||||
addPair("Cannot open directory", L"Kan niet open directory");
|
||||
addPair("Cannot open HTML file %s\n", L"Kan HTML-bestand niet openen %s\n");
|
||||
addPair("Command execute failure", L"Voeren commando falen");
|
||||
addPair("Command is not installed", L"Command is niet geïnstalleerd");
|
||||
addPair("Missing filename in %s\n", L"Ontbrekende bestandsnaam in %s\n");
|
||||
addPair("Recursive option with no wildcard", L"Recursieve optie met geen wildcard");
|
||||
addPair("Did you intend quote the filename", L"Heeft u van plan citaat van de bestandsnaam");
|
||||
addPair("No file to process %s\n", L"Geen bestand te verwerken %s\n");
|
||||
addPair("Did you intend to use --recursive", L"Hebt u van plan bent te gebruiken --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"Kan niet verwerken UTF-32 codering");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style heeft beëindigd");
|
||||
}
|
||||
|
||||
English::English()
|
||||
// this class is NOT translated
|
||||
{}
|
||||
|
||||
Finnish::Finnish() // Suomeksi
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Muotoiltu %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Ennallaan %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"Directory %s\n");
|
||||
addPair("Exclude %s\n", L"Sulkea %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Sulkea (verraton) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s muotoiltu %s ennallaan ");
|
||||
addPair(" seconds ", L" sekuntia ");
|
||||
addPair("%d min %d sec ", L"%d min %d sek ");
|
||||
addPair("%s lines\n", L"%s linjat\n");
|
||||
addPair("Using default options file %s\n", L"Käyttämällä oletusasetuksia tiedosto %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Avaaminen HTML asiakirjat %s\n");
|
||||
addPair("Invalid option file options:", L"Virheellinen vaihtoehto tiedosto vaihtoehtoja:");
|
||||
addPair("Invalid command line options:", L"Virheellinen komentorivin:");
|
||||
addPair("For help on options type 'astyle -h'", L"Apua vaihtoehdoista tyyppi 'astyle -h'");
|
||||
addPair("Cannot open options file", L"Ei voi avata vaihtoehtoja tiedostoa");
|
||||
addPair("Cannot open directory", L"Ei Open Directory");
|
||||
addPair("Cannot open HTML file %s\n", L"Ei voi avata HTML-tiedoston %s\n");
|
||||
addPair("Command execute failure", L"Suorita komento vika");
|
||||
addPair("Command is not installed", L"Komento ei ole asennettu");
|
||||
addPair("Missing filename in %s\n", L"Puuttuvat tiedostonimi %s\n");
|
||||
addPair("Recursive option with no wildcard", L"Rekursiivinen vaihtoehto ilman wildcard");
|
||||
addPair("Did you intend quote the filename", L"Oletko aio lainata tiedostonimi");
|
||||
addPair("No file to process %s\n", L"Ei tiedostoa käsitellä %s\n");
|
||||
addPair("Did you intend to use --recursive", L"Oliko aiot käyttää --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"Ei voi käsitellä UTF-32 koodausta");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style on päättynyt");
|
||||
}
|
||||
|
||||
French::French() // Française
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Formaté %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Inchangée %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"Répertoire %s\n");
|
||||
addPair("Exclude %s\n", L"Exclure %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Exclure (non appariés) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s formaté %s inchangée ");
|
||||
addPair(" seconds ", L" seconde ");
|
||||
addPair("%d min %d sec ", L"%d min %d sec ");
|
||||
addPair("%s lines\n", L"%s lignes\n");
|
||||
addPair("Using default options file %s\n", L"Options par défaut utilisation du fichier %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Ouverture documentation HTML %s\n");
|
||||
addPair("Invalid option file options:", L"Options Blancs option du fichier:");
|
||||
addPair("Invalid command line options:", L"Blancs options ligne de commande:");
|
||||
addPair("For help on options type 'astyle -h'", L"Pour de l'aide sur les options tapez 'astyle -h'");
|
||||
addPair("Cannot open options file", L"Impossible d'ouvrir le fichier d'options");
|
||||
addPair("Cannot open directory", L"Impossible d'ouvrir le répertoire");
|
||||
addPair("Cannot open HTML file %s\n", L"Impossible d'ouvrir le fichier HTML %s\n");
|
||||
addPair("Command execute failure", L"Exécuter échec de la commande");
|
||||
addPair("Command is not installed", L"Commande n'est pas installé");
|
||||
addPair("Missing filename in %s\n", L"Nom de fichier manquant dans %s\n");
|
||||
addPair("Recursive option with no wildcard", L"Option récursive sans joker");
|
||||
addPair("Did you intend quote the filename", L"Avez-vous l'intention de citer le nom de fichier");
|
||||
addPair("No file to process %s\n", L"Aucun fichier à traiter %s\n");
|
||||
addPair("Did you intend to use --recursive", L"Avez-vous l'intention d'utiliser --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"Impossible de traiter codage UTF-32");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style a mis fin");
|
||||
}
|
||||
|
||||
German::German() // Deutsch
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Formatiert %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Unverändert %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"Verzeichnis %s\n");
|
||||
addPair("Exclude %s\n", L"Ausschließen %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Ausschließen (unerreichte) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s formatiert %s unverändert ");
|
||||
addPair(" seconds ", L" sekunden ");
|
||||
addPair("%d min %d sec ", L"%d min %d sek ");
|
||||
addPair("%s lines\n", L"%s linien\n");
|
||||
addPair("Using default options file %s\n", L"Mit Standard-Optionen Dat %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Öffnen HTML-Dokumentation %s\n");
|
||||
addPair("Invalid option file options:", L"Ungültige Option Datei-Optionen:");
|
||||
addPair("Invalid command line options:", L"Ungültige Kommandozeilen-Optionen:");
|
||||
addPair("For help on options type 'astyle -h'", L"Für Hilfe zu den Optionen geben Sie 'astyle -h'");
|
||||
addPair("Cannot open options file", L"Kann nicht geöffnet werden Optionsdatei");
|
||||
addPair("Cannot open directory", L"Kann nicht geöffnet werden Verzeichnis");
|
||||
addPair("Cannot open HTML file %s\n", L"Kann nicht öffnen HTML-Datei %s\n");
|
||||
addPair("Command execute failure", L"Execute Befehl Scheitern");
|
||||
addPair("Command is not installed", L"Befehl ist nicht installiert");
|
||||
addPair("Missing filename in %s\n", L"Missing in %s Dateiname\n");
|
||||
addPair("Recursive option with no wildcard", L"Rekursive Option ohne Wildcard");
|
||||
addPair("Did you intend quote the filename", L"Haben Sie die Absicht Inhalte der Dateiname");
|
||||
addPair("No file to process %s\n", L"Keine Datei zu verarbeiten %s\n");
|
||||
addPair("Did you intend to use --recursive", L"Haben Sie verwenden möchten --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"Nicht verarbeiten kann UTF-32 Codierung");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style ist beendet");
|
||||
}
|
||||
|
||||
Hindi::Hindi() // हिन्दी
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
// NOTE: Scintilla based editors (CodeBlocks) cannot always edit Hindi.
|
||||
// Use Visual Studio instead.
|
||||
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(" 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"एचटीएमएल प्रलेखन खोलना %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 समाप्त किया है");
|
||||
}
|
||||
|
||||
Italian::Italian() // Italiano
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Formattata %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Immutato %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"Elenco %s\n");
|
||||
addPair("Exclude %s\n", L"Escludere %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Escludere (senza pari) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s ormattata %s immutato ");
|
||||
addPair(" seconds ", L" secondo ");
|
||||
addPair("%d min %d sec ", L"%d min %d seg ");
|
||||
addPair("%s lines\n", L"%s linee\n");
|
||||
addPair("Using default options file %s\n", L"Utilizzando file delle opzioni di default %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Apertura di documenti HTML %s\n");
|
||||
addPair("Invalid option file options:", L"Opzione non valida file delle opzioni:");
|
||||
addPair("Invalid command line options:", L"Opzioni della riga di comando non valido:");
|
||||
addPair("For help on options type 'astyle -h'", L"Per informazioni sulle opzioni di tipo 'astyle-h'");
|
||||
addPair("Cannot open options file", L"Impossibile aprire il file opzioni");
|
||||
addPair("Cannot open directory", L"Impossibile aprire la directory");
|
||||
addPair("Cannot open HTML file %s\n", L"Impossibile aprire il file HTML %s\n");
|
||||
addPair("Command execute failure", L"Esegui fallimento comando");
|
||||
addPair("Command is not installed", L"Il comando non è installato");
|
||||
addPair("Missing filename in %s\n", L"Nome del file mancante in %s\n");
|
||||
addPair("Recursive option with no wildcard", L"Opzione ricorsiva senza jolly");
|
||||
addPair("Did you intend quote the filename", L"Avete intenzione citare il nome del file");
|
||||
addPair("No file to process %s\n", L"Nessun file al processo %s\n");
|
||||
addPair("Did you intend to use --recursive", L"Hai intenzione di utilizzare --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"Non è possibile processo di codifica UTF-32");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style ha terminato");
|
||||
}
|
||||
|
||||
Japanese::Japanese() // 日本
|
||||
{
|
||||
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(" 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 実行が終了しました");
|
||||
}
|
||||
|
||||
Korean::Korean() // 한국의
|
||||
{
|
||||
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(" %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를 종료합니다");
|
||||
}
|
||||
|
||||
Polish::Polish() // Polski
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Sformatowany %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Niezmienione %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"Katalog %s\n");
|
||||
addPair("Exclude %s\n", L"Wykluczać %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Wyklucz (niezrównany) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s sformatowany %s niezmienione ");
|
||||
addPair(" seconds ", L" sekund ");
|
||||
addPair("%d min %d sec ", L"%d min %d sek ");
|
||||
addPair("%s lines\n", L"%s linii\n");
|
||||
addPair("Using default options file %s\n", L"Korzystanie z domyślnej opcji %s plik\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Otwarcie dokumentacji HTML %s\n");
|
||||
addPair("Invalid option file options:", L"Nieprawidłowy opcji pliku opcji:");
|
||||
addPair("Invalid command line options:", L"Nieprawidłowe opcje wiersza polecenia:");
|
||||
addPair("For help on options type 'astyle -h'", L"Aby uzyskać pomoc od rodzaju opcji 'astyle -h'");
|
||||
addPair("Cannot open options file", L"Nie można otworzyć pliku opcji");
|
||||
addPair("Cannot open directory", L"Nie można otworzyć katalogu");
|
||||
addPair("Cannot open HTML file %s\n", L"Nie można otworzyć pliku HTML %s\n");
|
||||
addPair("Command execute failure", L"Wykonaj polecenia niepowodzenia");
|
||||
addPair("Command is not installed", L"Polecenie nie jest zainstalowany");
|
||||
addPair("Missing filename in %s\n", L"Brakuje pliku w %s\n");
|
||||
addPair("Recursive option with no wildcard", L"Rekurencyjne opcja bez symboli");
|
||||
addPair("Did you intend quote the filename", L"Czy zamierza Pan podać nazwę pliku");
|
||||
addPair("No file to process %s\n", L"Brak pliku do procesu %s\n");
|
||||
addPair("Did you intend to use --recursive", L"Czy masz zamiar używać --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"Nie można procesu kodowania UTF-32");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style został zakończony");
|
||||
}
|
||||
|
||||
Portuguese::Portuguese() // Português
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Formatado %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Inalterado %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"Diretório %s\n");
|
||||
addPair("Exclude %s\n", L"Excluir %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Excluir (incomparável) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s formatado %s inalterado ");
|
||||
addPair(" seconds ", L" segundo ");
|
||||
addPair("%d min %d sec ", L"%d min %d seg ");
|
||||
addPair("%s lines\n", L"%s linhas\n");
|
||||
addPair("Using default options file %s\n", L"Usando o arquivo de opções padrão %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Abrindo a documentação HTML %s\n");
|
||||
addPair("Invalid option file options:", L"Opções de arquivo inválido opção:");
|
||||
addPair("Invalid command line options:", L"Opções de linha de comando inválida:");
|
||||
addPair("For help on options type 'astyle -h'", L"Para obter ajuda sobre as opções de tipo 'astyle -h'");
|
||||
addPair("Cannot open options file", L"Não é possível abrir arquivo de opções");
|
||||
addPair("Cannot open directory", L"Não é possível abrir diretório");
|
||||
addPair("Cannot open HTML file %s\n", L"Não é possível abrir arquivo HTML %s\n");
|
||||
addPair("Command execute failure", L"Executar falha de comando");
|
||||
addPair("Command is not installed", L"Comando não está instalado");
|
||||
addPair("Missing filename in %s\n", L"Filename faltando em %s\n");
|
||||
addPair("Recursive option with no wildcard", L"Opção recursiva sem curinga");
|
||||
addPair("Did you intend quote the filename", L"Será que você pretende citar o nome do arquivo");
|
||||
addPair("No file to process %s\n", L"Nenhum arquivo para processar %s\n");
|
||||
addPair("Did you intend to use --recursive", L"Será que você pretende usar --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"Não pode processar a codificação UTF-32");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style terminou");
|
||||
}
|
||||
|
||||
Russian::Russian() // русский
|
||||
// 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(" 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 прекратил");
|
||||
}
|
||||
|
||||
Spanish::Spanish() // Español
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Formato %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Inalterado %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"Directorio %s\n");
|
||||
addPair("Exclude %s\n", L"Excluir %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Excluir (incomparable) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s formato %s inalterado ");
|
||||
addPair(" seconds ", L" segundo ");
|
||||
addPair("%d min %d sec ", L"%d min %d seg ");
|
||||
addPair("%s lines\n", L"%s líneas\n");
|
||||
addPair("Using default options file %s\n", L"Uso de las opciones por defecto del archivo %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Apertura de documentación HTML %s\n");
|
||||
addPair("Invalid option file options:", L"Opción no válida opciones de archivo:");
|
||||
addPair("Invalid command line options:", L"No válido opciones de línea de comando:");
|
||||
addPair("For help on options type 'astyle -h'", L"Para obtener ayuda sobre las opciones tipo 'astyle -h'");
|
||||
addPair("Cannot open options file", L"No se puede abrir el archivo de opciones");
|
||||
addPair("Cannot open directory", L"No se puede abrir el directorio");
|
||||
addPair("Cannot open HTML file %s\n", L"No se puede abrir el archivo HTML %s\n");
|
||||
addPair("Command execute failure", L"Ejecutar el fracaso de comandos");
|
||||
addPair("Command is not installed", L"El comando no está instalado");
|
||||
addPair("Missing filename in %s\n", L"Falta nombre del archivo en %s\n");
|
||||
addPair("Recursive option with no wildcard", L"Recursiva opción sin comodín");
|
||||
addPair("Did you intend quote the filename", L"Se tiene la intención de citar el nombre de archivo");
|
||||
addPair("No file to process %s\n", L"No existe el fichero a procesar %s\n");
|
||||
addPair("Did you intend to use --recursive", L"Se va a utilizar --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"No se puede procesar la codificación UTF-32");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style ha terminado");
|
||||
}
|
||||
|
||||
Swedish::Swedish() // Svenska
|
||||
// build the translation vector in the Translation base class
|
||||
{
|
||||
addPair("Formatted %s\n", L"Formaterade %s\n"); // should align with unchanged
|
||||
addPair("Unchanged %s\n", L"Oförändrade %s\n"); // should align with formatted
|
||||
addPair("Directory %s\n", L"Katalog %s\n");
|
||||
addPair("Exclude %s\n", L"Uteslut %s\n");
|
||||
addPair("Exclude (unmatched) %s\n", L"Uteslut (oöverträffad) %s\n");
|
||||
addPair(" %s formatted %s unchanged ", L" %s formaterade %s oförändrade ");
|
||||
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"Använda standardalternativ fil %s\n");
|
||||
addPair("Opening HTML documentation %s\n", L"Öppna HTML-dokumentation %s\n");
|
||||
addPair("Invalid option file options:", L"Ogiltigt alternativ fil alternativ:");
|
||||
addPair("Invalid command line options:", L"Ogiltig kommandoraden alternativ:");
|
||||
addPair("For help on options type 'astyle -h'", L"För hjälp om alternativ typ 'astyle -h'");
|
||||
addPair("Cannot open options file", L"Kan inte öppna inställningsfilen");
|
||||
addPair("Cannot open directory", L"Kan inte öppna katalog");
|
||||
addPair("Cannot open HTML file %s\n", L"Kan inte öppna HTML-filen %s\n");
|
||||
addPair("Command execute failure", L"Utför kommando misslyckande");
|
||||
addPair("Command is not installed", L"Kommandot är inte installerat");
|
||||
addPair("Missing filename in %s\n", L"Saknade filnamn i %s\n");
|
||||
addPair("Recursive option with no wildcard", L"Rekursiva alternativ utan jokertecken");
|
||||
addPair("Did you intend quote the filename", L"Visste du tänker citera filnamnet");
|
||||
addPair("No file to process %s\n", L"Ingen fil att bearbeta %s\n");
|
||||
addPair("Did you intend to use --recursive", L"Har du för avsikt att använda --recursive");
|
||||
addPair("Cannot process UTF-32 encoding", L"Kan inte hantera UTF-32 kodning");
|
||||
addPair("\nArtistic Style has terminated", L"\nArtistic Style har upphört");
|
||||
}
|
||||
|
||||
Ukrainian::Ukrainian() // Український
|
||||
// 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(" seconds ", L" секунди ");
|
||||
addPair("%d min %d sec ", L"%d хви %d cek ");
|
||||
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 припинив");
|
||||
}
|
||||
|
||||
|
||||
#endif // ASTYLE_LIB
|
||||
|
||||
} // end of namespace astyle
|
||||
|
209
src/ASLocalizer.h
Normal file
209
src/ASLocalizer.h
Normal file
@ -0,0 +1,209 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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/>.
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*/
|
||||
|
||||
#ifndef ASLOCALIZER_H
|
||||
#define ASLOCALIZER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace astyle {
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifndef ASTYLE_LIB
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ASLocalizer class for console build.
|
||||
// This class encapsulates all language-dependent settings and is a
|
||||
// generalization of the C locale concept.
|
||||
//-----------------------------------------------------------------------------
|
||||
class Translation;
|
||||
|
||||
class ASLocalizer
|
||||
{
|
||||
public: // functions
|
||||
ASLocalizer();
|
||||
virtual ~ASLocalizer();
|
||||
string getLanguageID() const;
|
||||
const Translation* getTranslationClass() const;
|
||||
#ifdef _WIN32
|
||||
void setLanguageFromLCID(size_t lcid);
|
||||
#endif
|
||||
void setLanguageFromName(const char* langID);
|
||||
const char* settext(const char* textIn) const;
|
||||
|
||||
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)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Translation base class.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class Translation
|
||||
// This base class is inherited by the language translation classes.
|
||||
// Polymorphism is used to call the correct language translator.
|
||||
// This class contains the translation vector and settext translation method.
|
||||
// The language vector is built by the language sub classes.
|
||||
// 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;
|
||||
|
||||
protected:
|
||||
void addPair(const string &english, const wstring &translated);
|
||||
// variables
|
||||
vector<pair<string, wstring> > m_translation; // translation vector
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Translation classes
|
||||
// One class for each language.
|
||||
// These classes have only a constructor which builds the language vector.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class ChineseSimplified : public Translation
|
||||
{
|
||||
public:
|
||||
ChineseSimplified();
|
||||
};
|
||||
|
||||
class ChineseTraditional : public Translation
|
||||
{
|
||||
public:
|
||||
ChineseTraditional();
|
||||
};
|
||||
|
||||
class Dutch : public Translation
|
||||
{
|
||||
public:
|
||||
Dutch();
|
||||
};
|
||||
|
||||
class English : public Translation
|
||||
{
|
||||
public:
|
||||
English();
|
||||
};
|
||||
|
||||
class Finnish : public Translation
|
||||
{
|
||||
public:
|
||||
Finnish();
|
||||
};
|
||||
|
||||
class French : public Translation
|
||||
{
|
||||
public:
|
||||
French();
|
||||
};
|
||||
|
||||
class German : public Translation
|
||||
{
|
||||
public:
|
||||
German();
|
||||
};
|
||||
|
||||
class Hindi : public Translation
|
||||
{
|
||||
public:
|
||||
Hindi();
|
||||
};
|
||||
|
||||
class Italian : public Translation
|
||||
{
|
||||
public:
|
||||
Italian();
|
||||
};
|
||||
|
||||
class Japanese : public Translation
|
||||
{
|
||||
public:
|
||||
Japanese();
|
||||
};
|
||||
|
||||
class Korean : public Translation
|
||||
{
|
||||
public:
|
||||
Korean();
|
||||
};
|
||||
|
||||
class Polish : public Translation
|
||||
{
|
||||
public:
|
||||
Polish();
|
||||
};
|
||||
|
||||
class Portuguese : public Translation
|
||||
{
|
||||
public:
|
||||
Portuguese();
|
||||
};
|
||||
|
||||
class Russian : public Translation
|
||||
{
|
||||
public:
|
||||
Russian();
|
||||
};
|
||||
|
||||
class Spanish : public Translation
|
||||
{
|
||||
public:
|
||||
Spanish();
|
||||
};
|
||||
|
||||
class Swedish : public Translation
|
||||
{
|
||||
public:
|
||||
Swedish();
|
||||
};
|
||||
|
||||
class Ukrainian : public Translation
|
||||
{
|
||||
public:
|
||||
Ukrainian();
|
||||
};
|
||||
|
||||
|
||||
#endif // ASTYLE_LIB
|
||||
|
||||
} // namespace astyle
|
||||
|
||||
#endif // ASLOCALIZER_H
|
610
src/ASResource.cpp
Normal file
610
src/ASResource.cpp
Normal file
@ -0,0 +1,610 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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/>.
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*/
|
||||
|
||||
#include "astyle.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace astyle {
|
||||
|
||||
const string ASResource::AS_IF = string("if");
|
||||
const string ASResource::AS_ELSE = string("else");
|
||||
const string ASResource::AS_FOR = string("for");
|
||||
const string ASResource::AS_DO = string("do");
|
||||
const string ASResource::AS_WHILE = string("while");
|
||||
const string ASResource::AS_SWITCH = string("switch");
|
||||
const string ASResource::AS_CASE = string("case");
|
||||
const string ASResource::AS_DEFAULT = string("default");
|
||||
const string ASResource::AS_CLASS = string("class");
|
||||
const string ASResource::AS_VOLATILE = string("volatile");
|
||||
const string ASResource::AS_INTERRUPT = string("interrupt");
|
||||
const string ASResource::AS_NOEXCEPT = string("noexcept");
|
||||
const string ASResource::AS_AUTORELEASEPOOL = string("autoreleasepool");
|
||||
const string ASResource::AS_STRUCT = string("struct");
|
||||
const string ASResource::AS_UNION = string("union");
|
||||
const string ASResource::AS_INTERFACE = string("interface");
|
||||
const string ASResource::AS_NAMESPACE = string("namespace");
|
||||
const string ASResource::AS_END = string("end");
|
||||
const string ASResource::AS_SELECTOR = string("selector");
|
||||
const string ASResource::AS_EXTERN = string("extern");
|
||||
const string ASResource::AS_ENUM = string("enum");
|
||||
const string ASResource::AS_PUBLIC = string("public");
|
||||
const string ASResource::AS_PROTECTED = string("protected");
|
||||
const string ASResource::AS_PRIVATE = string("private");
|
||||
const string ASResource::AS_STATIC = string("static");
|
||||
const string ASResource::AS_SYNCHRONIZED = string("synchronized");
|
||||
const string ASResource::AS_OPERATOR = string("operator");
|
||||
const string ASResource::AS_TEMPLATE = string("template");
|
||||
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_TRY = string("__try");
|
||||
const string ASResource::_AS_FINALLY = string("__finally");
|
||||
const string ASResource::_AS_EXCEPT = string("__except");
|
||||
const string ASResource::AS_THROWS = string("throws");
|
||||
const string ASResource::AS_CONST = string("const");
|
||||
const string ASResource::AS_SEALED = string("sealed");
|
||||
const string ASResource::AS_OVERRIDE = string("override");
|
||||
const string ASResource::AS_WHERE = string("where");
|
||||
const string ASResource::AS_LET = string("let");
|
||||
const string ASResource::AS_NEW = string("new");
|
||||
|
||||
const string ASResource::AS_ASM = string("asm");
|
||||
const string ASResource::AS__ASM__ = string("__asm__");
|
||||
const string ASResource::AS_MS_ASM = string("_asm");
|
||||
const string ASResource::AS_MS__ASM = string("__asm");
|
||||
|
||||
const string ASResource::AS_BAR_DEFINE = string("#define");
|
||||
const string ASResource::AS_BAR_INCLUDE = string("#include");
|
||||
const string ASResource::AS_BAR_IF = string("#if");
|
||||
const string ASResource::AS_BAR_EL = string("#el");
|
||||
const string ASResource::AS_BAR_ENDIF = string("#endif");
|
||||
|
||||
const string ASResource::AS_OPEN_BRACKET = string("{");
|
||||
const string ASResource::AS_CLOSE_BRACKET = string("}");
|
||||
const string ASResource::AS_OPEN_LINE_COMMENT = string("//");
|
||||
const string ASResource::AS_OPEN_COMMENT = string("/*");
|
||||
const string ASResource::AS_CLOSE_COMMENT = string("*/");
|
||||
|
||||
const string ASResource::AS_ASSIGN = string("=");
|
||||
const string ASResource::AS_PLUS_ASSIGN = string("+=");
|
||||
const string ASResource::AS_MINUS_ASSIGN = string("-=");
|
||||
const string ASResource::AS_MULT_ASSIGN = string("*=");
|
||||
const string ASResource::AS_DIV_ASSIGN = string("/=");
|
||||
const string ASResource::AS_MOD_ASSIGN = string("%=");
|
||||
const string ASResource::AS_OR_ASSIGN = string("|=");
|
||||
const string ASResource::AS_AND_ASSIGN = string("&=");
|
||||
const string ASResource::AS_XOR_ASSIGN = string("^=");
|
||||
const string ASResource::AS_GR_GR_ASSIGN = string(">>=");
|
||||
const string ASResource::AS_LS_LS_ASSIGN = string("<<=");
|
||||
const string ASResource::AS_GR_GR_GR_ASSIGN = string(">>>=");
|
||||
const string ASResource::AS_LS_LS_LS_ASSIGN = string("<<<=");
|
||||
const string ASResource::AS_GCC_MIN_ASSIGN = string("<?");
|
||||
const string ASResource::AS_GCC_MAX_ASSIGN = string(">?");
|
||||
|
||||
const string ASResource::AS_RETURN = string("return");
|
||||
const string ASResource::AS_CIN = string("cin");
|
||||
const string ASResource::AS_COUT = string("cout");
|
||||
const string ASResource::AS_CERR = string("cerr");
|
||||
|
||||
const string ASResource::AS_EQUAL = string("==");
|
||||
const string ASResource::AS_PLUS_PLUS = string("++");
|
||||
const string ASResource::AS_MINUS_MINUS = string("--");
|
||||
const string ASResource::AS_NOT_EQUAL = string("!=");
|
||||
const string ASResource::AS_GR_EQUAL = string(">=");
|
||||
const string ASResource::AS_GR_GR = string(">>");
|
||||
const string ASResource::AS_GR_GR_GR = string(">>>");
|
||||
const string ASResource::AS_LS_EQUAL = string("<=");
|
||||
const string ASResource::AS_LS_LS = string("<<");
|
||||
const string ASResource::AS_LS_LS_LS = string("<<<");
|
||||
const string ASResource::AS_QUESTION_QUESTION = string("??");
|
||||
const string ASResource::AS_LAMBDA = string("=>"); // C# lambda expression arrow
|
||||
const string ASResource::AS_ARROW = string("->");
|
||||
const string ASResource::AS_AND = string("&&");
|
||||
const string ASResource::AS_OR = string("||");
|
||||
const string ASResource::AS_SCOPE_RESOLUTION = string("::");
|
||||
|
||||
const string ASResource::AS_PLUS = string("+");
|
||||
const string ASResource::AS_MINUS = string("-");
|
||||
const string ASResource::AS_MULT = string("*");
|
||||
const string ASResource::AS_DIV = string("/");
|
||||
const string ASResource::AS_MOD = string("%");
|
||||
const string ASResource::AS_GR = string(">");
|
||||
const string ASResource::AS_LS = string("<");
|
||||
const string ASResource::AS_NOT = string("!");
|
||||
const string ASResource::AS_BIT_OR = string("|");
|
||||
const string ASResource::AS_BIT_AND = string("&");
|
||||
const string ASResource::AS_BIT_NOT = string("~");
|
||||
const string ASResource::AS_BIT_XOR = string("^");
|
||||
const string ASResource::AS_QUESTION = string("?");
|
||||
const string ASResource::AS_COLON = string(":");
|
||||
const string ASResource::AS_COMMA = string(",");
|
||||
const string ASResource::AS_SEMICOLON = string(";");
|
||||
|
||||
const string ASResource::AS_QFOREACH = string("Q_FOREACH");
|
||||
const string ASResource::AS_QFOREVER = string("Q_FOREVER");
|
||||
const string ASResource::AS_FOREVER = string("forever");
|
||||
const string ASResource::AS_FOREACH = string("foreach");
|
||||
const string ASResource::AS_LOCK = string("lock");
|
||||
const string ASResource::AS_UNSAFE = string("unsafe");
|
||||
const string ASResource::AS_FIXED = string("fixed");
|
||||
const string ASResource::AS_GET = string("get");
|
||||
const string ASResource::AS_SET = string("set");
|
||||
const string ASResource::AS_ADD = string("add");
|
||||
const string ASResource::AS_REMOVE = string("remove");
|
||||
const string ASResource::AS_DELEGATE = string("delegate");
|
||||
const string ASResource::AS_UNCHECKED = string("unchecked");
|
||||
|
||||
const string ASResource::AS_CONST_CAST = string("const_cast");
|
||||
const string ASResource::AS_DYNAMIC_CAST = string("dynamic_cast");
|
||||
const string ASResource::AS_REINTERPRET_CAST = string("reinterpret_cast");
|
||||
const string ASResource::AS_STATIC_CAST = string("static_cast");
|
||||
|
||||
const string ASResource::AS_NS_DURING = string("NS_DURING");
|
||||
const string ASResource::AS_NS_HANDLER = string("NS_HANDLER");
|
||||
|
||||
/**
|
||||
* Sort comparison function.
|
||||
* Compares the length of the value of pointers in the vectors.
|
||||
* The LONGEST strings will be first in the vector.
|
||||
*
|
||||
* @param a and b, the string pointers to be compared.
|
||||
*/
|
||||
bool sortOnLength(const string* a, const string* b)
|
||||
{
|
||||
return (*a).length() > (*b).length();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort comparison function.
|
||||
* Compares the value of pointers in the vectors.
|
||||
*
|
||||
* @param a and b, the string pointers to be compared.
|
||||
*/
|
||||
bool sortOnName(const string* a, const string* b)
|
||||
{
|
||||
return *a < *b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the vector of assignment operators.
|
||||
* Used by BOTH ASFormatter.cpp and ASBeautifier.cpp
|
||||
*
|
||||
* @param assignmentOperators a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildAssignmentOperators(vector<const string*>* assignmentOperators)
|
||||
{
|
||||
assignmentOperators->push_back(&AS_ASSIGN);
|
||||
assignmentOperators->push_back(&AS_PLUS_ASSIGN);
|
||||
assignmentOperators->push_back(&AS_MINUS_ASSIGN);
|
||||
assignmentOperators->push_back(&AS_MULT_ASSIGN);
|
||||
assignmentOperators->push_back(&AS_DIV_ASSIGN);
|
||||
assignmentOperators->push_back(&AS_MOD_ASSIGN);
|
||||
assignmentOperators->push_back(&AS_OR_ASSIGN);
|
||||
assignmentOperators->push_back(&AS_AND_ASSIGN);
|
||||
assignmentOperators->push_back(&AS_XOR_ASSIGN);
|
||||
|
||||
// Java
|
||||
assignmentOperators->push_back(&AS_GR_GR_GR_ASSIGN);
|
||||
assignmentOperators->push_back(&AS_GR_GR_ASSIGN);
|
||||
assignmentOperators->push_back(&AS_LS_LS_ASSIGN);
|
||||
|
||||
// Unknown
|
||||
assignmentOperators->push_back(&AS_LS_LS_LS_ASSIGN);
|
||||
|
||||
sort(assignmentOperators->begin(), assignmentOperators->end(), sortOnLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the vector of C++ cast operators.
|
||||
* Used by ONLY ASFormatter.cpp
|
||||
*
|
||||
* @param castOperators a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildCastOperators(vector<const string*>* castOperators)
|
||||
{
|
||||
castOperators->push_back(&AS_CONST_CAST);
|
||||
castOperators->push_back(&AS_DYNAMIC_CAST);
|
||||
castOperators->push_back(&AS_REINTERPRET_CAST);
|
||||
castOperators->push_back(&AS_STATIC_CAST);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the vector of header words.
|
||||
* Used by BOTH ASFormatter.cpp and ASBeautifier.cpp
|
||||
*
|
||||
* @param headers a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildHeaders(vector<const string*>* headers, int fileType, bool beautifier)
|
||||
{
|
||||
headers->push_back(&AS_IF);
|
||||
headers->push_back(&AS_ELSE);
|
||||
headers->push_back(&AS_FOR);
|
||||
headers->push_back(&AS_WHILE);
|
||||
headers->push_back(&AS_DO);
|
||||
headers->push_back(&AS_SWITCH);
|
||||
headers->push_back(&AS_CASE);
|
||||
headers->push_back(&AS_DEFAULT);
|
||||
headers->push_back(&AS_TRY);
|
||||
headers->push_back(&AS_CATCH);
|
||||
headers->push_back(&AS_QFOREACH); // QT
|
||||
headers->push_back(&AS_QFOREVER); // QT
|
||||
headers->push_back(&AS_FOREACH); // QT & C#
|
||||
headers->push_back(&AS_FOREVER); // Qt & Boost
|
||||
|
||||
if (fileType == C_TYPE)
|
||||
{
|
||||
headers->push_back(&_AS_TRY); // __try
|
||||
headers->push_back(&_AS_FINALLY); // __finally
|
||||
headers->push_back(&_AS_EXCEPT); // __except
|
||||
}
|
||||
if (fileType == JAVA_TYPE)
|
||||
{
|
||||
headers->push_back(&AS_FINALLY);
|
||||
headers->push_back(&AS_SYNCHRONIZED);
|
||||
}
|
||||
|
||||
if (fileType == SHARP_TYPE)
|
||||
{
|
||||
headers->push_back(&AS_FINALLY);
|
||||
headers->push_back(&AS_LOCK);
|
||||
headers->push_back(&AS_FIXED);
|
||||
headers->push_back(&AS_GET);
|
||||
headers->push_back(&AS_SET);
|
||||
headers->push_back(&AS_ADD);
|
||||
headers->push_back(&AS_REMOVE);
|
||||
}
|
||||
|
||||
if (beautifier)
|
||||
{
|
||||
if (fileType == C_TYPE)
|
||||
{
|
||||
headers->push_back(&AS_TEMPLATE);
|
||||
}
|
||||
|
||||
if (fileType == JAVA_TYPE)
|
||||
{
|
||||
headers->push_back(&AS_STATIC); // for static constructor
|
||||
}
|
||||
}
|
||||
sort(headers->begin(), headers->end(), sortOnName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the vector of indentable headers.
|
||||
* Used by ONLY ASBeautifier.cpp
|
||||
*
|
||||
* @param indentableHeaders a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildIndentableHeaders(vector<const string*>* indentableHeaders)
|
||||
{
|
||||
indentableHeaders->push_back(&AS_RETURN);
|
||||
|
||||
sort(indentableHeaders->begin(), indentableHeaders->end(), sortOnName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the vector of indentable macros pairs.
|
||||
* Initialized by ASFormatter, used by ONLY ASEnhancer.cpp
|
||||
*
|
||||
* @param indentableMacros a reference to the vector to be built.
|
||||
*/
|
||||
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[] =
|
||||
{
|
||||
// wxWidgets
|
||||
make_pair("BEGIN_EVENT_TABLE", "END_EVENT_TABLE"),
|
||||
make_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"),
|
||||
};
|
||||
|
||||
size_t elements = sizeof(macros) / sizeof(macros[0]);
|
||||
for (size_t i = 0; i < elements; i++)
|
||||
indentableMacros->push_back(¯os[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the vector of non-assignment operators.
|
||||
* Used by ONLY ASBeautifier.cpp
|
||||
*
|
||||
* @param nonAssignmentOperators a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildNonAssignmentOperators(vector<const string*>* nonAssignmentOperators)
|
||||
{
|
||||
nonAssignmentOperators->push_back(&AS_EQUAL);
|
||||
nonAssignmentOperators->push_back(&AS_PLUS_PLUS);
|
||||
nonAssignmentOperators->push_back(&AS_MINUS_MINUS);
|
||||
nonAssignmentOperators->push_back(&AS_NOT_EQUAL);
|
||||
nonAssignmentOperators->push_back(&AS_GR_EQUAL);
|
||||
nonAssignmentOperators->push_back(&AS_GR_GR_GR);
|
||||
nonAssignmentOperators->push_back(&AS_GR_GR);
|
||||
nonAssignmentOperators->push_back(&AS_LS_EQUAL);
|
||||
nonAssignmentOperators->push_back(&AS_LS_LS_LS);
|
||||
nonAssignmentOperators->push_back(&AS_LS_LS);
|
||||
nonAssignmentOperators->push_back(&AS_ARROW);
|
||||
nonAssignmentOperators->push_back(&AS_AND);
|
||||
nonAssignmentOperators->push_back(&AS_OR);
|
||||
nonAssignmentOperators->push_back(&AS_LAMBDA);
|
||||
|
||||
sort(nonAssignmentOperators->begin(), nonAssignmentOperators->end(), sortOnLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the vector of header non-paren headers.
|
||||
* Used by BOTH ASFormatter.cpp and ASBeautifier.cpp.
|
||||
* NOTE: Non-paren headers should also be included in the headers vector.
|
||||
*
|
||||
* @param nonParenHeaders a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildNonParenHeaders(vector<const string*>* nonParenHeaders, int fileType, bool beautifier)
|
||||
{
|
||||
nonParenHeaders->push_back(&AS_ELSE);
|
||||
nonParenHeaders->push_back(&AS_DO);
|
||||
nonParenHeaders->push_back(&AS_TRY);
|
||||
nonParenHeaders->push_back(&AS_CATCH); // can be paren or non-paren
|
||||
nonParenHeaders->push_back(&AS_CASE); // can be paren or non-paren
|
||||
nonParenHeaders->push_back(&AS_DEFAULT);
|
||||
nonParenHeaders->push_back(&AS_QFOREVER); // QT
|
||||
nonParenHeaders->push_back(&AS_FOREVER); // Boost
|
||||
|
||||
if (fileType == C_TYPE)
|
||||
{
|
||||
nonParenHeaders->push_back(&_AS_TRY); // __try
|
||||
nonParenHeaders->push_back(&_AS_FINALLY); // __finally
|
||||
}
|
||||
if (fileType == JAVA_TYPE)
|
||||
{
|
||||
nonParenHeaders->push_back(&AS_FINALLY);
|
||||
}
|
||||
|
||||
if (fileType == SHARP_TYPE)
|
||||
{
|
||||
nonParenHeaders->push_back(&AS_FINALLY);
|
||||
nonParenHeaders->push_back(&AS_GET);
|
||||
nonParenHeaders->push_back(&AS_SET);
|
||||
nonParenHeaders->push_back(&AS_ADD);
|
||||
nonParenHeaders->push_back(&AS_REMOVE);
|
||||
}
|
||||
|
||||
if (beautifier)
|
||||
{
|
||||
if (fileType == C_TYPE)
|
||||
{
|
||||
nonParenHeaders->push_back(&AS_TEMPLATE);
|
||||
}
|
||||
if (fileType == JAVA_TYPE)
|
||||
{
|
||||
nonParenHeaders->push_back(&AS_STATIC);
|
||||
}
|
||||
}
|
||||
sort(nonParenHeaders->begin(), nonParenHeaders->end(), sortOnName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the vector of operators.
|
||||
* Used by ONLY ASFormatter.cpp
|
||||
*
|
||||
* @param operators a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildOperators(vector<const string*>* operators, int fileType)
|
||||
{
|
||||
operators->push_back(&AS_PLUS_ASSIGN);
|
||||
operators->push_back(&AS_MINUS_ASSIGN);
|
||||
operators->push_back(&AS_MULT_ASSIGN);
|
||||
operators->push_back(&AS_DIV_ASSIGN);
|
||||
operators->push_back(&AS_MOD_ASSIGN);
|
||||
operators->push_back(&AS_OR_ASSIGN);
|
||||
operators->push_back(&AS_AND_ASSIGN);
|
||||
operators->push_back(&AS_XOR_ASSIGN);
|
||||
operators->push_back(&AS_EQUAL);
|
||||
operators->push_back(&AS_PLUS_PLUS);
|
||||
operators->push_back(&AS_MINUS_MINUS);
|
||||
operators->push_back(&AS_NOT_EQUAL);
|
||||
operators->push_back(&AS_GR_EQUAL);
|
||||
operators->push_back(&AS_GR_GR_GR_ASSIGN);
|
||||
operators->push_back(&AS_GR_GR_ASSIGN);
|
||||
operators->push_back(&AS_GR_GR_GR);
|
||||
operators->push_back(&AS_GR_GR);
|
||||
operators->push_back(&AS_LS_EQUAL);
|
||||
operators->push_back(&AS_LS_LS_LS_ASSIGN);
|
||||
operators->push_back(&AS_LS_LS_ASSIGN);
|
||||
operators->push_back(&AS_LS_LS_LS);
|
||||
operators->push_back(&AS_LS_LS);
|
||||
operators->push_back(&AS_QUESTION_QUESTION);
|
||||
operators->push_back(&AS_LAMBDA);
|
||||
operators->push_back(&AS_ARROW);
|
||||
operators->push_back(&AS_AND);
|
||||
operators->push_back(&AS_OR);
|
||||
operators->push_back(&AS_SCOPE_RESOLUTION);
|
||||
operators->push_back(&AS_PLUS);
|
||||
operators->push_back(&AS_MINUS);
|
||||
operators->push_back(&AS_MULT);
|
||||
operators->push_back(&AS_DIV);
|
||||
operators->push_back(&AS_MOD);
|
||||
operators->push_back(&AS_QUESTION);
|
||||
operators->push_back(&AS_COLON);
|
||||
operators->push_back(&AS_ASSIGN);
|
||||
operators->push_back(&AS_LS);
|
||||
operators->push_back(&AS_GR);
|
||||
operators->push_back(&AS_NOT);
|
||||
operators->push_back(&AS_BIT_OR);
|
||||
operators->push_back(&AS_BIT_AND);
|
||||
operators->push_back(&AS_BIT_NOT);
|
||||
operators->push_back(&AS_BIT_XOR);
|
||||
if (fileType == C_TYPE)
|
||||
{
|
||||
operators->push_back(&AS_GCC_MIN_ASSIGN);
|
||||
operators->push_back(&AS_GCC_MAX_ASSIGN);
|
||||
}
|
||||
sort(operators->begin(), operators->end(), sortOnLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the vector of pre-block statements.
|
||||
* Used by ONLY ASBeautifier.cpp
|
||||
* NOTE: Cannot be both a header and a preBlockStatement.
|
||||
*
|
||||
* @param preBlockStatements a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildPreBlockStatements(vector<const string*>* preBlockStatements, int fileType)
|
||||
{
|
||||
preBlockStatements->push_back(&AS_CLASS);
|
||||
if (fileType == C_TYPE)
|
||||
{
|
||||
preBlockStatements->push_back(&AS_STRUCT);
|
||||
preBlockStatements->push_back(&AS_UNION);
|
||||
preBlockStatements->push_back(&AS_NAMESPACE);
|
||||
}
|
||||
if (fileType == JAVA_TYPE)
|
||||
{
|
||||
preBlockStatements->push_back(&AS_INTERFACE);
|
||||
preBlockStatements->push_back(&AS_THROWS);
|
||||
}
|
||||
if (fileType == SHARP_TYPE)
|
||||
{
|
||||
preBlockStatements->push_back(&AS_INTERFACE);
|
||||
preBlockStatements->push_back(&AS_NAMESPACE);
|
||||
preBlockStatements->push_back(&AS_WHERE);
|
||||
preBlockStatements->push_back(&AS_STRUCT);
|
||||
}
|
||||
sort(preBlockStatements->begin(), preBlockStatements->end(), sortOnName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the vector of pre-command headers.
|
||||
* Used by BOTH ASFormatter.cpp and ASBeautifier.cpp.
|
||||
* NOTE: Cannot be both a header and a preCommandHeader.
|
||||
*
|
||||
* A preCommandHeader is in a function definition between
|
||||
* the closing paren and the opening bracket.
|
||||
* e.g. in "void foo() const {}", "const" is a preCommandHeader.
|
||||
*/
|
||||
void ASResource::buildPreCommandHeaders(vector<const string*>* preCommandHeaders, int fileType)
|
||||
{
|
||||
if (fileType == C_TYPE)
|
||||
{
|
||||
preCommandHeaders->push_back(&AS_CONST);
|
||||
preCommandHeaders->push_back(&AS_VOLATILE);
|
||||
preCommandHeaders->push_back(&AS_INTERRUPT);
|
||||
preCommandHeaders->push_back(&AS_NOEXCEPT);
|
||||
preCommandHeaders->push_back(&AS_OVERRIDE);
|
||||
preCommandHeaders->push_back(&AS_SEALED); // Visual C only
|
||||
preCommandHeaders->push_back(&AS_AUTORELEASEPOOL); // Obj-C only
|
||||
}
|
||||
|
||||
if (fileType == JAVA_TYPE)
|
||||
{
|
||||
preCommandHeaders->push_back(&AS_THROWS);
|
||||
}
|
||||
|
||||
if (fileType == SHARP_TYPE)
|
||||
{
|
||||
preCommandHeaders->push_back(&AS_WHERE);
|
||||
}
|
||||
|
||||
sort(preCommandHeaders->begin(), preCommandHeaders->end(), sortOnName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the vector of pre-definition headers.
|
||||
* Used by ONLY ASFormatter.cpp
|
||||
* NOTE: Do NOT add 'enum' here. It is an array type bracket.
|
||||
* NOTE: Do NOT add 'extern' here. Do not want an extra indent.
|
||||
*
|
||||
* @param preDefinitionHeaders a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildPreDefinitionHeaders(vector<const string*>* preDefinitionHeaders, int fileType)
|
||||
{
|
||||
preDefinitionHeaders->push_back(&AS_CLASS);
|
||||
if (fileType == C_TYPE)
|
||||
{
|
||||
preDefinitionHeaders->push_back(&AS_STRUCT);
|
||||
preDefinitionHeaders->push_back(&AS_UNION);
|
||||
preDefinitionHeaders->push_back(&AS_NAMESPACE);
|
||||
}
|
||||
if (fileType == JAVA_TYPE)
|
||||
{
|
||||
preDefinitionHeaders->push_back(&AS_INTERFACE);
|
||||
}
|
||||
if (fileType == SHARP_TYPE)
|
||||
{
|
||||
preDefinitionHeaders->push_back(&AS_STRUCT);
|
||||
preDefinitionHeaders->push_back(&AS_INTERFACE);
|
||||
preDefinitionHeaders->push_back(&AS_NAMESPACE);
|
||||
}
|
||||
sort(preDefinitionHeaders->begin(), preDefinitionHeaders->end(), sortOnName);
|
||||
}
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* ASBase Functions
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
// check if a specific line position contains a keyword.
|
||||
bool ASBase::findKeyword(const string &line, int i, const string &keyword) const
|
||||
{
|
||||
assert(isCharPotentialHeader(line, i));
|
||||
// check the word
|
||||
const size_t keywordLength = keyword.length();
|
||||
const size_t wordEnd = i + keywordLength;
|
||||
if (wordEnd > line.length())
|
||||
return false;
|
||||
if (line.compare(i, keywordLength, keyword) != 0)
|
||||
return false;
|
||||
// check that this is not part of a longer word
|
||||
if (wordEnd == line.length())
|
||||
return true;
|
||||
if (isLegalNameChar(line[wordEnd]))
|
||||
return false;
|
||||
// is not a keyword if part of a definition
|
||||
const char peekChar = peekNextChar(line, wordEnd - 1);
|
||||
if (peekChar == ',' || peekChar == ')')
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
assert(isCharPotentialHeader(line, index));
|
||||
size_t lineLength = line.length();
|
||||
size_t i;
|
||||
for (i = index; i < lineLength; i++)
|
||||
{
|
||||
if (!isLegalNameChar(line[i]))
|
||||
break;
|
||||
}
|
||||
return line.substr(index, i - index);
|
||||
}
|
||||
|
||||
} // end namespace astyle
|
1029
src/astyle.h
Normal file
1029
src/astyle.h
Normal file
File diff suppressed because it is too large
Load Diff
3783
src/astyle_main.cpp
Normal file
3783
src/astyle_main.cpp
Normal file
File diff suppressed because it is too large
Load Diff
459
src/astyle_main.h
Normal file
459
src/astyle_main.h
Normal file
@ -0,0 +1,459 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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/>.
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*/
|
||||
|
||||
#ifndef ASTYLE_MAIN_H
|
||||
#define ASTYLE_MAIN_H
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// headers
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "astyle.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <ctime>
|
||||
|
||||
#if defined(__BORLANDC__) && __BORLANDC__ < 0x0650
|
||||
// Embarcadero needs this for the following utime.h
|
||||
// otherwise "struct utimbuf" gets an error on time_t
|
||||
// 0x0650 for C++Builder XE3
|
||||
using std::time_t;
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__DMC__)
|
||||
#include <sys/utime.h>
|
||||
#include <sys/stat.h>
|
||||
#else
|
||||
#include <utime.h>
|
||||
#include <sys/stat.h>
|
||||
#endif // end compiler checks
|
||||
|
||||
#ifdef ASTYLE_JNI
|
||||
#include <jni.h>
|
||||
#ifndef ASTYLE_LIB // ASTYLE_LIB must be defined for ASTYLE_JNI
|
||||
#define ASTYLE_LIB
|
||||
#endif
|
||||
#endif // ASTYLE_JNI
|
||||
|
||||
#ifndef ASTYLE_LIB
|
||||
// for console build only
|
||||
#include "ASLocalizer.h"
|
||||
#define _(a) localizer.settext(a)
|
||||
#endif // ASTYLE_LIB
|
||||
|
||||
// for G++ implementation of string.compare:
|
||||
#if defined(__GNUC__) && __GNUC__ < 3
|
||||
#error - Use GNU C compiler release 3 or higher
|
||||
#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
|
||||
|
||||
// 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))
|
||||
#error - Use MinGW compiler version 4 or higher
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// definitions
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifdef ASTYLE_LIB
|
||||
|
||||
// define STDCALL and EXPORT for Windows
|
||||
// MINGW defines STDCALL in Windows.h (actually windef.h)
|
||||
// EXPORT has no value if ASTYLE_NO_EXPORT is defined
|
||||
#ifdef _WIN32
|
||||
#ifndef STDCALL
|
||||
#define STDCALL __stdcall
|
||||
#endif
|
||||
// define this to prevent compiler warning and error messages
|
||||
#ifdef ASTYLE_NO_EXPORT
|
||||
#define EXPORT
|
||||
#else
|
||||
#define EXPORT __declspec(dllexport)
|
||||
#endif
|
||||
// define STDCALL and EXPORT for non-Windows
|
||||
// visibility attribute allows "-fvisibility=hidden" compiler option
|
||||
#else
|
||||
#define STDCALL
|
||||
#if __GNUC__ >= 4
|
||||
#define EXPORT __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
#define EXPORT
|
||||
#endif
|
||||
#endif // #ifdef _WIN32
|
||||
|
||||
// define utf-16 bit text for the platform
|
||||
typedef unsigned short utf16_t;
|
||||
// define pointers to callback error handler and memory allocation
|
||||
typedef void (STDCALL* fpError)(int errorNumber, const char* errorMessage);
|
||||
typedef char* (STDCALL* fpAlloc)(unsigned long memoryNeeded);
|
||||
|
||||
#endif // #ifdef ASTYLE_LIB
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// astyle namespace
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
namespace astyle {
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ASStreamIterator class
|
||||
// typename will be istringstream for GUI and istream otherwise
|
||||
// ASSourceIterator is an abstract class defined in astyle.h
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
template<typename T>
|
||||
class ASStreamIterator : public ASSourceIterator
|
||||
{
|
||||
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();
|
||||
|
||||
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
|
||||
|
||||
public: // inline functions
|
||||
bool compareToInputBuffer(const string &nextLine_) const
|
||||
{ return (nextLine_ == prevBuffer); }
|
||||
const char* getOutputEOL() const { return outputEOL; }
|
||||
bool hasMoreLines() const { return !inStream->eof(); }
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Utf8_16 class for utf8/16 conversions
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
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 };
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ASOptions class for options processing
|
||||
// used by both console and library builds
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
#ifndef ASTYLE_LIB
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ASConsole class for console build
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class ASConsole
|
||||
{
|
||||
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
|
||||
char outputEOL[4]; // current line end
|
||||
char prevEOL[4]; // previous line end
|
||||
|
||||
Utf8_16 utf8_16; // utf8/16 conversion methods
|
||||
|
||||
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;
|
||||
#ifdef _WIN32
|
||||
void displayLastError();
|
||||
#endif
|
||||
};
|
||||
#else // ASTYLE_LIB
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ASLibrary class for library build
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
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;
|
||||
|
||||
private:
|
||||
static char* STDCALL tempMemoryAllocation(unsigned long memoryNeeded);
|
||||
|
||||
private:
|
||||
Utf8_16 utf8_16; // utf8/16 conversion methods
|
||||
};
|
||||
|
||||
#endif // ASTYLE_LIB
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
} // end of namespace astyle
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// declarations for java native interface (JNI) build
|
||||
// they are called externally and are NOT part of the namespace
|
||||
//----------------------------------------------------------------------------
|
||||
#ifdef ASTYLE_JNI
|
||||
void STDCALL javaErrorHandler(int errorNumber, const char* errorMessage);
|
||||
char* STDCALL javaMemoryAlloc(unsigned long memoryNeeded);
|
||||
// the following function names are constructed from method names in the calling java program
|
||||
extern "C" EXPORT
|
||||
jstring STDCALL Java_AStyleInterface_AStyleGetVersion(JNIEnv* env, jclass);
|
||||
extern "C" EXPORT
|
||||
jstring STDCALL Java_AStyleInterface_AStyleMain(JNIEnv* env,
|
||||
jobject obj,
|
||||
jstring textInJava,
|
||||
jstring optionsJava);
|
||||
#endif // ASTYLE_JNI
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// declarations for UTF-16 interface
|
||||
// they are called externally and are NOT part of the namespace
|
||||
//----------------------------------------------------------------------------
|
||||
#ifdef ASTYLE_LIB
|
||||
extern "C" EXPORT
|
||||
utf16_t* STDCALL AStyleMainUtf16(const utf16_t* pSourceIn,
|
||||
const utf16_t* pOptions,
|
||||
fpError fpErrorHandler,
|
||||
fpAlloc fpMemoryAlloc);
|
||||
#endif // ASTYLE_LIB
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declarations for standard DLL interface
|
||||
// they are called externally and are NOT part of the namespace
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifdef ASTYLE_LIB
|
||||
extern "C" EXPORT char* STDCALL AStyleMain(const char* sourceIn,
|
||||
const char* optionsIn,
|
||||
fpError errorHandler,
|
||||
fpAlloc memoryAlloc);
|
||||
extern "C" EXPORT const char* STDCALL AStyleGetVersion(void);
|
||||
#endif // ASTYLE_LIB
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // closes ASTYLE_MAIN_H
|
Loading…
x
Reference in New Issue
Block a user