📄 astyle.html
字号:
<html>
<head>
<TITLE>Artistic Style</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
</head>
<body bgcolor="#ffffff">
<h1 align="center"><font color="#0000a0" size="7"><i>Artistic Style 1.15.3<BR>
</i></font>
</h1>
<h3 align="center"><font size="5">A </font><A href="license.html"><font size="5">Free</font></A><font size="5">
, Fast and Small Automatic Formatter<br>
for </font><font color="#0000a0" size="5">C</font><font color="#000000" size="5">
,</font><font color="#0000a0" size="5"> C++ </font><font color="#000000" size="5">
,</font><font color="#0000a0" size="5"> C# <FONT color="#000000" size="5"><FONT color="#000000" size="5">
,</FONT></FONT> Java</font><font size="5"> Source Codes</font></h3>
<h3 align="center"><font size="3">by </font><a href="http://www.bigfoot.com/~davidsont">
<font size="3">Tal Davidson</font></a><font size="3">, Israel (E-mail: </font>
<A href="mailto:davidsont@bigfoot.com"><font size="3">davidsont@bigfoot.com</font></A><font size="3">)</font></h3>
<blockquote>
<h3 align="center"><font size="3">
<table height="108" cellspacing="1" cellpadding="1" width="473" border="0">
<tr>
<td><strong>Main home Page</strong></td>
<td><a href="http://astyle.sourceforge.net">http://astyle.sourceforge.net</a></td>
</tr>
<tr>
<td><strong>Project Page</strong></td>
<td><a href="http://www.sourceforge.net/projects/astyle">http://www.sourceforge.net/projects/astyle</a></td>
</tr>
</table>
</font><font size="3"></font>
</h3>
<p> </p>
</blockquote>
<p><font color="#000000" size="3">Artistic Style is a <b>reindenter and reformatter</b>
of <b>C, C++, C# and Java </b>source code.</font>
</p>
<p><font color="#000000" size="3">When indenting source code, we as programmers have a
tendency to use both <b>spaces</b> and <b>tab</b> characters to create the
wanted indentation. Moreover, some editors by default insert spaces instead of
tabs when pressing the tab key, and other editors (Emacs for example) have the
ability to "pretty up" lines by automatically setting up the white space before
the code on the line, possibly inserting spaces in a code that up to now used
only tabs for indentation</font><font size="4">.</font>
</p>
<p><font size="3">Since the <b>NUMBER</b> of space characters showed on screen for each
tab character in the source code changes between editors (until the user sets
up the number to his liking...), </font><font color="#000000" size="3"><b>one of
the standard problems facing programmers when moving from one source code
editor to another</b> is that code containing both spaces and tabs that was
up to now perfectly indented, suddently becomes a mess to look at when changing
to another editor. Even if you as a programmer take care to ONLY use spaces or
tabs, looking at other peoples source code can still be problematic.</font>
</p>
<p align="left"><font color="#000000" size="3">To address this problem I have created
Artistic Style - a series of filters, written in <b>C++</b>, that automatically
reindent & reformat C/C++/C#/Java source files. These can be used from a <b>command
line</b>, or it can be <b>incorporated as classes in another C++ program</b>.</font>
<br>
</p>
<h3>Read <A href="astyle_release_notes.html">Release Notes</A><BR>
</h3>
<p>
</p>
<h3>Read <A href="license.html">License</A></h3>
<blockquote>
<p>Artistic Style may be used and distributed under the <font size="4"><b>GNU General
Public License (GPL)</b></font>.
<BR>
</p>
</blockquote>
<h3><font size="4">New versions, Comments, Questions, Bugs and Ideas for Improvement:</font></h3>
<UL dir="ltr" style="MARGIN-RIGHT: 0px">
<LI dir="ltr">
<DIV><FONT size="3"><STRONG>Visit Astyle's project page at </STRONG></FONT><a href="http://www.sourceforge.net/projects/astyle">
<FONT size="3"><STRONG>http://www.sourceforge.net/projects/astyle</STRONG></FONT></a><FONT size="3"><STRONG> for:</STRONG></FONT></DIV>
<UL>
<LI>
Astyle sources and binaries
<LI>
<font>Mailing lists</font>
<LI>
<DIV><font>Bug tracking facilities<BR>
</font>
</DIV>
</LI>
</UL>
<LI>
<font size="3"><STRONG>Author's e-mail: Reach me directly at </STRONG></font><A href="mailto:davidsont@bigfoot.com">
<font size="3"><STRONG>davidsont@bigfoot.com</STRONG></font></A> <br>
</LI>
</UL>
<h3><font color="#000000" size="4">To use from the command line:</font></h3>
<blockquote>
<p><font color="#000000" size="3">1) Unzip astyle.zip and compile 'astyle' (read
README.txt for instructions).</font>
</p>
<p><font color="#000000" size="3">2) Either place the resulting executable file's
directory in your PATH system-variable, or move the executable to a directory
that appears in your PATH system-variable.</font>
</p>
<p><font color="#000000" size="3">3) Run it with the following syntax:</font>
</p>
<blockquote>
<p><font color="#800080" size="3" face="Times New Roman"><b><tt>astyle </tt></b></font>
<font color="#000080" size="3" face="Times New Roman"><b><tt>[options] </tt></b></font>
<font color="#ff0000" size="5" face="Times New Roman"><b><tt><</tt></b></font><font color="#800080" size="3" face="Times New Roman"><b><tt>
OriginalSourceFile </tt></b></font><font color="#ff0000" size="5" face="Times New Roman">
<b><tt>></tt></b></font><font color="#800080" size="3" face="Times New Roman"><b><tt>
BeautifiedSourceFile</tt></b></font>
</p>
<blockquote>
<p><font size="4"><b>OR</b></font></p>
</blockquote>
<p><font color="#800080" size="3" face="Times New Roman"><b><tt>astyle </tt></b></font>
<font color="#000080" size="3" face="Times New Roman"><b><tt>[options] </tt></b></font>
<font color="#800080" size="3" face="Times New Roman"><b><tt>Foo.java
Bar.javaAnotherBar.java</tt></b></font><font color="#000080" size="3" face="Times New Roman"><b><tt>
[ . . . ]</tt></b></font>
</p>
<p><font color="#000000" size="3">The </font><font color="#ff0000" size="5"><b><</b></font><font color="#000000" size="3">
and</font><font color="#ff0000" size="5"><b> ></b></font><font color="#000000" size="3">
characters are used to redirect the files into standard input and out of
standard output - don't forget them!!!</font>
<br>
</p>
<p><font color="#330000" size="3">The newly indented file </font><font color="#ff0000" size="3">
<strong>RETAINS the original file name</strong></font><font color="#330000" size="3">,
while a copy of the original file is created with a "</font><font color="#ff0000" size="3"><strong>.orig</strong></font><font color="#330000" size="3">"
appended to the original file name.</font><font size="2"> </font><font color="#330000" size="3">
Thus, after indenting </font><font color="#800080" size="3"><strong>Foo.java</strong></font><font color="#330000" size="3">
as above, the indented result will be named </font><font color="#993399" size="3">
<strong>Foo.java</strong></font><font color="#330000" size="3">, while the
original pre-indented file will be renamed to </font><font color="#993399" size="3">
<strong>Foo.java.orig</strong> </font><font color="#330000" size="3">.</font></p>
</blockquote></blockquote>
<h3><font color="#000000" size="4">Options:</font></h3>
<blockquote>
<p><font size="3">Not specifying any option will bring to C/C++/C# style indentation,
with a default of 4 spaces per indent, and NO formatting.</font><font size="2"> </font>
</p>
<p><font color="#000000" size="4"><strong>Options may be written in two different ways:</strong></font></p>
<ol>
<li>
<strong>Long options:</strong><p>These options start with '<font color="#ff0000"><strong>--</strong></font>',
and <font color="#ff0000"><strong>must be written one at a time</strong></font><br>
(e.g. <font color="#000080" size="3" face="Times New Roman"><strong>--brackets=attach</strong></font><font size="2"><b> </b></font><font color="#000080" size="3" face="Times New Roman"><strong>--pad</strong></font><font size="2"><b> </b></font><font color="#000080" size="3" face="Times New Roman"><strong>--indent=spaces=4</strong></font>
).</p>
<li>
<strong>Short Options:</strong><p>These options start with a single '<font color="#ff0000"><strong>-</strong></font>',
and <font color="#ff0000" size="3"><strong>may be appended together</strong></font><font size="4">.</font><br>
Thus, writing <font color="#000080" size="3" face="Times New Roman"><strong>-bps4</strong></font>
is the same as writing <font color="#000080" size="4" face="Times New Roman"><strong>-</strong></font><font color="#000080" size="3" face="Times New Roman"><strong>b</strong></font><font size="2"><b> -</b></font><font color="#000080" size="3" face="Times New Roman"><strong>p</strong></font><font size="2"><b> -</b></font><font color="#000080" size="3" face="Times New Roman"><strong>s4</strong></font><font color="#000080"><strong>
</strong></font><font color="#400040" size="2" face="Courier New">.<br>
</font>
</p>
</li>
</ol>
<p><font color="#000000" size="4"><strong>A </strong></font><font color="#ff0000" size="4">
<strong>default options file</strong></font><font color="#000000" size="4"><strong>
may be used to define default options:</strong></font></p>
<ul>
<li>
<font color="#000000" size="3">Artistic Style looks for the default options file in
the following order:
<br>
1. The value of the the system variable </font><font color="#000080" size="3"><strong>
ARTISTIC_STYLE_OPTIONS</strong></font><font color="#000000" size="3"> if
one exists.<br>
2. The file named <strong>.astylerc</strong> in the directory pointed to by the </font>
<font color="#000080" size="3"><strong>HOME</strong></font><font color="#000000" size="3">
system variable (i.e. </font><font color="#000080" size="3"><strong>$PATH</strong></font><font color="#000000" size="3"><strong>/.astylerc</strong>)<br>
3. The file named <strong>.astylerc</strong> in the directory pointed to by the </font>
<font color="#000080" size="3"><strong>HOMEPATH</strong></font><font color="#000000" size="3">
system variable (i.e. </font><font color="#000080" size="3"><strong>%HOMEPATH%</strong></font><font color="#000000" size="3"><strong>\.astylerc</strong>)</font></li>
</ul>
<ul>
<li>
<font color="#000000" size="3">Options may be set apart by new-lines, tabs or
spaces.</font>
<li>
<font color="#000000" size="3">Long options <strong>may be written in the options file
without the preceding '--'</strong>.</font>
<li>
<font color="#000000" size="3">Lines within the options file that begin with '</font><font color="#ff0000" size="3"><strong>#</strong></font><font color="#000000" size="3">'
are considered <strong>line-comments</strong>.<br>
</font>
<li>
<font color="#000000" size="3">Example contents of a default options file:</font><blockquote>
<p><font color="#ff0000" size="3" face="Times New Roman"><tt># default parsing is of java
files</tt></font><font color="#800080" size="3" face="Times New Roman"><tt><br>
mode=java<br>
</tt></font><font color="#ff0000" size="3" face="Times New Roman"><tt># brackets
should be attached to pre-bracket lines</tt></font><font color="#800080" size="3" face="Times New Roman"><tt><br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -