资源下载:http://download.csdn.net/detail/v__king__/9814151
linux如何将AStyle集成到你的c工程
- 新建一个AStyle的目录
- 把AStyle.exe和test.sh脚本放到工程AStyle目录中,加入Makefile
shell脚本
#!/bin/bash
find ./ -name "*.c" | xargs AStyle -c --style=ansi
find ./ -name "*.h" | xargs AStyle -c --style=ansi
DOS的脚本
rem 将当前目录和所有子目录的*.c,*.h文件格式化
rem 注意历史原因dos不识别utf8编码的中文
rem 编辑dos脚本需要保存为ansi编码,
rem 可以用其他编辑器编辑,在复制到记事本中
rem add by VkingMan@20170721
@echo off
for /R "../" %%s in (,*.h) do AStyle.exe --style=ansi %%s
set /p var=删除所有的备份文件*.orig?(Y/N):
if %var% equ Y (
echo "rm all the *.orig"
for /R "../" %%s in (*.orig) do del %%s
)
if %var% equ y (
echo "rm all the *.orig"
for /R "../" %%s in (*.orig) do del %%s
)
pause
本文介绍如何将AStyle代码格式化工具集成到C工程项目中。通过创建AStyle目录并放置AStyle.exe及test.sh脚本,利用Makefile进行配置。提供Linux下使用bash和DOS下的批处理命令,实现对C和H文件的格式化。

684

被折叠的 条评论
为什么被折叠?



