2011-11-06 17:09:08 +01:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
#
|
|
|
|
|
# Requirements:
|
|
|
|
|
# astyle >=2.02
|
|
|
|
|
#
|
|
|
|
|
|
2012-02-22 18:33:44 +01:00
|
|
|
|
function format_sources {
|
|
|
|
|
astyle --indent=spaces=4 --style=1tbs \
|
2011-11-06 17:09:08 +01:00
|
|
|
|
--indent-labels --pad-oper --unpad-paren --pad-header \
|
|
|
|
|
--convert-tabs --indent-preprocessor --break-closing-brackets \
|
|
|
|
|
--align-pointer=type --align-reference=name \
|
|
|
|
|
`find -type f -name '*.cpp'`
|
2012-02-22 18:33:44 +01:00
|
|
|
|
|
|
|
|
|
rm */*.orig
|
|
|
|
|
}
|
2011-11-06 17:09:08 +01:00
|
|
|
|
|
2012-02-22 18:33:44 +01:00
|
|
|
|
function format_headers {
|
|
|
|
|
astyle --indent=spaces=4 --style=linux \
|
2011-11-06 17:09:08 +01:00
|
|
|
|
--indent-labels --pad-oper --unpad-paren --pad-header \
|
|
|
|
|
--keep-one-line-statements --keep-one-line-blocks \
|
|
|
|
|
--indent-preprocessor --convert-tabs \
|
|
|
|
|
--align-pointer=type --align-reference=name \
|
|
|
|
|
`find -type f -name '*.h'`
|
|
|
|
|
|
2012-02-22 18:33:44 +01:00
|
|
|
|
rm */*.orig
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cd ../src
|
|
|
|
|
echo "running astyle for *.cpp ..."
|
|
|
|
|
format_sources
|
|
|
|
|
|
|
|
|
|
echo "running astyle for *.h ..."
|
|
|
|
|
format_headers
|
2011-11-06 19:46:03 +01:00
|
|
|
|
|
2011-11-06 17:09:08 +01:00
|
|
|
|
read -p "Press [ENTER] to close terminal"
|
|
|
|
|
exit
|