liuning587 发表于 2012-2-28 15:21:01

分享windows下好用的代码格式整理软件Astyle

分享一个开源代码整理工具(Astyle),资料在附件中,内涵Astyle

http://cache.amobbs.com/bbs_upload782111/files_52/ourdev_722904UQ8KEA.png
(原文件名:截图00.png)
AStyle_2.02_windows.zip   --->AStyle的源码
Astyle调整代码格式.pdf    --->SourceInsight中使用Astyle的方法
调整代码格式.bat          --->使用方法:1.拷贝至需要整理代码的根目录;2.双击运行,根据提示执行即可。
附件:点击此处下载 ourdev_722905IM1AY8.zip(文件大小:675K) (原文件名:Astyle调整代码格式.zip)

liuning587 发表于 2012-2-28 15:22:19

批处理中需要改变Astyle.exe的路径,或者增加至环境变量中。

liuning587 发表于 2012-2-28 15:24:22

http://cache.amobbs.com/bbs_upload782111/files_52/ourdev_722906BE6UZY.png
allman格式 (原文件名:allman.png)

http://cache.amobbs.com/bbs_upload782111/files_52/ourdev_722907P2DLTT.png
java格式 (原文件名:java.png)

MyOS 发表于 2012-2-28 15:57:32

如何更改TAB空格,由4个改为2个?


知道了

theophilus 发表于 2012-2-28 16:01:54

回复【3楼】MyOS
如何更改tab空格,由4个改为2个?
-----------------------------------------------------------------------

--indent=spaces=2

MyOS 发表于 2012-2-28 16:07:19

直接 -s2 就可以

Excellence 发表于 2012-2-28 17:06:05

不错。
顶。

liuning587 发表于 2012-2-28 18:27:41

Tab Options

default indent
If no indentation option is set, the default option of 4 spaces will be used (e.g. -s4 --indent=spaces=4).

--indent=spaces / --indent=spaces=# / -s#
Indent using # spaces per indent (e.g. -s6 --indent=spaces=6). # must be between 2 and 20. Not specifying # will result in a default of 4 spaces per indent.

--indent=tab / --indent=tab=# / -t / -t#
Indent using tab characters. Treat each tab as # spaces (e.g. -t6 / --indent=tab=6). # must be between 2 and 20. If no # is set, treats tabs as 4 spaces.

--indent=force-tab / --indent=force-tab=# / -T / -T#
Indent using tab characters. Treat each tab as # spaces (e.g. -T6 / --indent=force-tab=6). Uses tabs as indents where ‑‑indent=tab prefers to use spaces, such as inside multi-line statements. # must be between 2 and 20. If no # is set, treats tabs as 4 spaces.

liuning587 发表于 2012-2-28 18:29:12

Astyle使用方法可以参考:Astyle压缩包doc目录里有astyle.html文件。

wwwdege 发表于 2012-2-28 18:34:22

UltraEdit UEStudio 都集成有Astyle的...
Artistic style (Astyle) formatter (visually beautifies source code)

http://cache.amobbs.com/bbs_upload782111/files_52/ourdev_722939X5YJTW.jpg
(原文件名:11111111111111.jpg)

http://cache.amobbs.com/bbs_upload782111/files_52/ourdev_722940HEWYH0.jpg
(原文件名:22222222.jpg)

liangyurongde 发表于 2012-2-28 19:24:17

mark

i55x 发表于 2012-2-28 19:48:05

Astyle这个软件的bug特别多,遇到真正的大项目就麻爪了,比如用它格式化ucgui的源码会出一百多个错误。
真正专业好用的源码格式化工具是indent。

kakarotto 发表于 2012-2-28 19:52:19

mark

liuning587 发表于 2012-2-28 22:02:11

回复【11楼】i55x
-----------------------------------------------------------------------

刚刚试了,貌似没有发现整理ucGUI会产生错误。
不知道indent怎么样,下来看看。

airfex 发表于 2012-2-28 22:16:57

马瑞卡

MyOS 发表于 2012-2-29 14:24:44

回复【11楼】i55x
astyle这个软件的bug特别多,遇到真正的大项目就麻爪了,比如用它格式化ucgui的源码会出一百多个错误。
真正专业好用的源码格式化工具是indent。
-----------------------------------------------------------------------

第一次使用这类软件,astyle很快就熟悉了,我把astyle添加进了uestudio的工具配置,可是indent不知道怎么操作,能否赐教?

mathison 发表于 2013-5-12 10:26:40

我自己用的批处理

set astyle="D:\Program Files\AStyle\bin\astyle.exe"
这个要自行修改

使用方法:1.拷贝至需要整理代码的根目录;2.双击运行

Joinj 发表于 2014-8-12 10:27:53

最近新装W7发现 Astyle运行没反应的现象,郁闷好久,终于找到了解决方法,将 custom commands中Astyle的配置路径的双引号去掉,运行一次Astyle会提示找不到文件,再把双引号重新加回去,在运行一次Astyle就正常了···真TM奇葩···上来标记一下,方便出现同样问题的人
页: [1]
查看完整版本: 分享windows下好用的代码格式整理软件Astyle