本文主要目的是介绍如何用AStyle集成到SourceInsight环境中进行C代码的格式化处理。
AStyle:Artistic Style
0. 打开Base Project.
1. 选择菜单“Options-->Custom Commands-->Add”, 输入Format code with AStyle
2. Run中输入: C:/astyle/bin/Astyle.exe --style=ansi –s4 -S -N -L -m0 -M40 -U --convert-tabs --suffix=.pre %f
3. Dir留空,将Iconic Window, Capture Output, Parse Links in OutPut, File,then Line 四项前打上勾。可以不选,选择了会在执行后弹出控制台程序界面。
4. 然后点对话框中右侧的按钮“Menu”, Menu--->Menu-->Work--><end of menu>, 右侧Insert, OK.
5. 此时在SourceInsight中的Work菜单下多了个Format code with AStyle的子菜单选项,可以用它来对单个C/C++文件进行格式化。
6. 保存相关的配置:Options|Save Configurations;