2018-10-13 18:39:37 +02:00
|
|
|
|
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.
|
2018-01-08 20:20:33 +01:00
|
|
|
ASTYLE_VERSION="Artistic Style Version 3.0.1"
|
2014-12-18 15:58:17 +01:00
|
|
|
ASTYLE="astyle"
|
2011-06-22 13:20:36 +02:00
|
|
|
|
2014-12-18 16:02:26 +01:00
|
|
|
DETECTED_VERSION=`$ASTYLE --version 2>&1`
|
|
|
|
if [[ "$DETECTED_VERSION" != ${ASTYLE_VERSION}* ]]; then
|
2012-09-28 20:25:46 +02:00
|
|
|
echo "You should use: ${ASTYLE_VERSION}";
|
2014-12-18 16:02:26 +01:00
|
|
|
echo "Detected: ${DETECTED_VERSION}"
|
2012-09-28 20:25:46 +02:00
|
|
|
exit 1;
|
2011-02-11 22:37:38 +01:00
|
|
|
fi
|
2009-01-05 16:52:02 +01:00
|
|
|
|
2018-01-08 20:20:33 +01:00
|
|
|
style="--style=kr --indent=spaces=4 --indent-namespaces --lineend=linux --min-conditional-indent=0"
|
|
|
|
options="--options=none --pad-header --unpad-paren --suffix=none --convert-tabs --attach-inlines --attach-classes --attach-namespaces"
|
2010-07-31 16:28:24 +02:00
|
|
|
|
2014-12-18 15:58:17 +01:00
|
|
|
$ASTYLE $style $options cli/*.cpp
|
|
|
|
$ASTYLE $style $options cli/*.h
|
|
|
|
$ASTYLE $style $options democlient/*.cpp
|
|
|
|
$ASTYLE $style $options gui/*.cpp
|
|
|
|
$ASTYLE $style $options gui/*.h
|
|
|
|
$ASTYLE $style $options -r gui/test/*.cpp
|
|
|
|
$ASTYLE $style $options -r gui/test/*.h
|
|
|
|
$ASTYLE $style $options lib/*.cpp
|
|
|
|
$ASTYLE $style $options lib/*.h
|
|
|
|
$ASTYLE $style $options test/*.cpp
|
2018-06-20 09:56:10 +02:00
|
|
|
$ASTYLE $style $options test/cfg/*.c
|
|
|
|
$ASTYLE $style $options test/cfg/*.cpp
|
2014-12-18 15:58:17 +01:00
|
|
|
$ASTYLE $style $options test/*.h
|
2010-07-31 16:28:24 +02:00
|
|
|
|
2018-01-01 09:22:11 +01:00
|
|
|
$ASTYLE $style $options --recursive "tools/*.cpp"
|
|
|
|
$ASTYLE $style $options --recursive "tools/*.h"
|
|
|
|
|
2014-12-18 15:58:17 +01:00
|
|
|
$ASTYLE $style $options --recursive "samples/*.c"
|
|
|
|
$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?
|
2014-10-16 06:38:18 +02:00
|
|
|
for CFGFILE in cfg/*.cfg
|
|
|
|
do
|
|
|
|
xmllint --format -o ${CFGFILE}_ ${CFGFILE}
|
|
|
|
mv -f ${CFGFILE}_ ${CFGFILE}
|
|
|
|
done
|
2018-02-16 09:08:38 +01:00
|
|
|
for PLATFORMFILE in platforms/*.xml
|
|
|
|
do
|
|
|
|
xmllint --format -o ${PLATFORMFILE}_ ${PLATFORMFILE}
|
|
|
|
mv -f ${PLATFORMFILE}_ ${PLATFORMFILE}
|
|
|
|
done
|
2018-10-13 18:39:37 +02:00
|
|
|
|
|
|
|
xmllint --format -o man/cppcheck.1.xml_ man/cppcheck.1.xml
|
|
|
|
mv -f man/cppcheck.1.xml_ man/cppcheck.1.xml
|
2018-11-05 21:14:49 +01:00
|
|
|
|
|
|
|
xmllint --format -o cppcheck-errors_.rng cppcheck-errors.rng
|
|
|
|
mv cppcheck-errors_.rng cppcheck-errors.rng
|