2011-11-06 17:09:08 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Requirements:
|
2013-03-06 09:05:41 +01:00
|
|
|
# astyle > =2.02 (patched with foreach support)
|
|
|
|
# normalize (Qt tool to normalize all signal/slots format)
|
2011-11-06 17:09:08 +01:00
|
|
|
#
|
|
|
|
|
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 \
|
2013-03-06 09:05:41 +01:00
|
|
|
`find -type f -name '*.cpp'` | grep 'Formatted'
|
2013-01-21 22:38:31 +01:00
|
|
|
|
2012-02-24 21:03:44 +01:00
|
|
|
find . -name "*.orig" -print0 | xargs -0 rm -rf
|
2012-02-22 18:33:44 +01:00
|
|
|
}
|
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 \
|
2013-03-06 09:05:41 +01:00
|
|
|
`find -type f -name '*.h'` | grep 'Formatted'
|
2013-01-21 22:38:31 +01:00
|
|
|
|
2012-02-24 21:03:44 +01:00
|
|
|
find . -name "*.orig" -print0 | xargs -0 rm -rf
|
2012-02-22 18:33:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
cd ../src
|
2013-03-06 09:05:41 +01:00
|
|
|
echo "Running astyle for *.cpp ..."
|
2012-02-22 18:33:44 +01:00
|
|
|
format_sources
|
|
|
|
|
2013-03-06 09:05:41 +01:00
|
|
|
echo "Running astyle for *.h ..."
|
2012-02-22 18:33:44 +01:00
|
|
|
format_headers
|
2013-01-21 22:38:31 +01:00
|
|
|
|
2013-03-06 09:05:41 +01:00
|
|
|
echo "Running normalize ..."
|
|
|
|
normalize --modify .
|
|
|
|
|
2013-01-21 22:38:31 +01:00
|
|
|
exit 0
|