2009-01-05 16:52:02 +01:00
|
|
|
#!/bin/bash
|
2012-09-28 20:25:46 +02:00
|
|
|
# The version check in this script is used to avoid commit battles
|
2011-06-22 13:20:36 +02:00
|
|
|
# between different developers that use different astyle versions as
|
|
|
|
# different versions might have different output (this has happened in
|
|
|
|
# the past).
|
|
|
|
|
|
|
|
# If project management wishes to take a newer astyle version into use
|
2011-06-22 20:41:14 +02:00
|
|
|
# just change this string to match the start of astyle version string.
|
2013-08-07 16:27:37 +02:00
|
|
|
ASTYLE_VERSION="Artistic Style Version 2.03"
|
2011-06-22 13:20:36 +02:00
|
|
|
|
2011-06-22 20:41:14 +02:00
|
|
|
if [[ "`astyle --version 2>&1`" != ${ASTYLE_VERSION}* ]]; then
|
2012-09-28 20:25:46 +02:00
|
|
|
echo "You should use: ${ASTYLE_VERSION}";
|
|
|
|
exit 1;
|
2011-02-11 22:37:38 +01:00
|
|
|
fi
|
2009-01-05 16:52:02 +01:00
|
|
|
|
2011-10-13 20:53:06 +02:00
|
|
|
style="--style=stroustrup --indent=spaces=4 --indent-namespaces --lineend=linux --min-conditional-indent=0"
|
2014-01-16 01:29:33 +01:00
|
|
|
options="--options=none --pad-header --unpad-paren --suffix=none --convert-tabs"
|
2010-07-31 16:28:24 +02:00
|
|
|
|
|
|
|
astyle $style $options cli/*.cpp
|
|
|
|
astyle $style $options cli/*.h
|
2014-01-01 15:55:18 +01:00
|
|
|
astyle $style $options democlient/*.cpp
|
2010-07-31 16:28:24 +02:00
|
|
|
astyle $style $options gui/*.cpp
|
|
|
|
astyle $style $options gui/*.h
|
2011-06-10 13:20:43 +02:00
|
|
|
astyle $style $options -r gui/test/*.cpp
|
|
|
|
astyle $style $options -r gui/test/*.h
|
2010-07-31 16:28:24 +02:00
|
|
|
astyle $style $options lib/*.cpp
|
|
|
|
astyle $style $options lib/*.h
|
|
|
|
astyle $style $options test/*.cpp
|
|
|
|
astyle $style $options test/*.h
|
|
|
|
|
|
|
|
astyle $style $options tools/*.cpp
|
2012-01-17 22:03:21 +01:00
|
|
|
astyle $style $options --recursive "samples/*.c"
|
2012-01-22 14:52:31 +01:00
|
|
|
astyle $style $options --recursive "samples/*.cpp"
|
2012-10-03 20:14:23 +02:00
|
|
|
|
|
|
|
# Convert tabs to spaces.. even in strings
|
2013-01-24 19:44:42 +01:00
|
|
|
# sed -i "s/\t/ /g" test/test*.cpp
|
2012-10-03 20:14:23 +02:00
|
|
|
|
2014-10-14 06:46:22 +02:00
|
|
|
# format config files
|
|
|
|
# TODO: use other tool than xmllint? use tabs instead of spaces?
|
|
|
|
cat cfg/avr.cfg | xmllint --format - | tee cfg/avr.cfg > /dev/null
|
|
|
|
#cat cfg/gtk.cfg | xmllint --format - | tee cfg/gtk.cfg > /dev/null
|
|
|
|
cat cfg/linux.cfg | xmllint --format - | tee cfg/linux.cfg > /dev/null
|
|
|
|
cat cfg/posix.cfg | xmllint --format - | tee cfg/posix.cfg > /dev/null
|
|
|
|
cat cfg/qt.cfg | xmllint --format - | tee cfg/qt.cfg > /dev/null
|
|
|
|
cat cfg/sdl.cfg | xmllint --format - | tee cfg/sdl.cfg > /dev/null
|
|
|
|
cat cfg/std.cfg | xmllint --format - | tee cfg/std.cfg > /dev/null
|
|
|
|
cat cfg/windows.cfg | xmllint --format - | tee cfg/windows.cfg > /dev/null
|