搜索
bottom↓
回复: 17

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

[复制链接]

出0入0汤圆

发表于 2012-2-28 15:21:01 | 显示全部楼层 |阅读模式
分享一个开源代码整理工具(Astyle),资料在附件中,内涵Astyle


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

阿莫论坛20周年了!感谢大家的支持与爱护!!

曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……

出0入0汤圆

 楼主| 发表于 2012-2-28 15:22:19 | 显示全部楼层
批处理中需要改变Astyle.exe的路径,或者增加至环境变量中。

出0入0汤圆

 楼主| 发表于 2012-2-28 15:24:22 | 显示全部楼层

allman格式 (原文件名:allman.png)


java格式 (原文件名:java.png)

出0入0汤圆

发表于 2012-2-28 15:57:32 | 显示全部楼层
如何更改TAB空格,由4个改为2个?


知道了

出0入0汤圆

发表于 2012-2-28 16:01:54 | 显示全部楼层
回复【3楼】MyOS  
如何更改tab空格,由4个改为2个?
-----------------------------------------------------------------------

--indent=spaces=2

出0入0汤圆

发表于 2012-2-28 16:07:19 | 显示全部楼层
直接 -s2 就可以

出0入0汤圆

发表于 2012-2-28 17:06:05 | 显示全部楼层
不错。
顶。

出0入0汤圆

 楼主| 发表于 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.

出0入0汤圆

 楼主| 发表于 2012-2-28 18:29:12 | 显示全部楼层
Astyle使用方法可以参考:Astyle压缩包doc目录里有astyle.html文件。

出0入0汤圆

发表于 2012-2-28 18:34:22 | 显示全部楼层
UltraEdit UEStudio 都集成有Astyle的...
Artistic style (Astyle) formatter (visually beautifies source code)


(原文件名:11111111111111.jpg)


(原文件名:22222222.jpg)

出0入9汤圆

发表于 2012-2-28 19:24:17 | 显示全部楼层
mark

出0入0汤圆

发表于 2012-2-28 19:48:05 | 显示全部楼层
Astyle这个软件的bug特别多,遇到真正的大项目就麻爪了,比如用它格式化ucgui的源码会出一百多个错误。
真正专业好用的源码格式化工具是indent。

出0入0汤圆

发表于 2012-2-28 19:52:19 | 显示全部楼层
mark

出0入0汤圆

 楼主| 发表于 2012-2-28 22:02:11 | 显示全部楼层
回复【11楼】i55x  
-----------------------------------------------------------------------

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

出0入0汤圆

发表于 2012-2-28 22:16:57 | 显示全部楼层
马瑞卡

出0入0汤圆

发表于 2012-2-29 14:24:44 | 显示全部楼层
回复【11楼】i55x
astyle这个软件的bug特别多,遇到真正的大项目就麻爪了,比如用它格式化ucgui的源码会出一百多个错误。
真正专业好用的源码格式化工具是indent。
-----------------------------------------------------------------------

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

出0入0汤圆

发表于 2013-5-12 10:26:40 | 显示全部楼层
我自己用的批处理

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

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

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

发表于 2014-8-12 10:27:53 | 显示全部楼层
最近新装W7发现 Astyle运行没反应的现象,郁闷好久,终于找到了解决方法,将 custom commands中Astyle的配置路径的双引号去掉,运行一次Astyle会提示找不到文件,再把双引号重新加回去,在运行一次Astyle就正常了···真TM奇葩···上来标记一下,方便出现同样问题的人
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-8-25 21:19

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表