From c07cb64f2f04331d083ebe5eaf9b5083b87a2dba Mon Sep 17 00:00:00 2001 From: amai2012 Date: Fri, 9 Nov 2018 09:55:34 +0100 Subject: [PATCH] =?UTF-8?q?Move=20astyle=20options=20to=20a=20separate=20f?= =?UTF-8?q?ile.=20That=20way=20keeping=20it=20in=20sync=20b=E2=80=A6=20(#1?= =?UTF-8?q?468)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Move astyle options to a separate file. That way keeping it in sync between different os is more simple. --- .astylerc | 20 ++++++++++++++++++++ runastyle | 37 ++++++++++++++++++------------------- runastyle.bat | 37 ++++++++++++++++++------------------- 3 files changed, 56 insertions(+), 38 deletions(-) create mode 100755 .astylerc diff --git a/.astylerc b/.astylerc new file mode 100755 index 000000000..450a57322 --- /dev/null +++ b/.astylerc @@ -0,0 +1,20 @@ +############################################################## +# Documentation is available from # +# http://astyle.sourceforge.net/astyle.html # +############################################################## + +### Options ### +--pad-header +--unpad-paren +--suffix=none +--convert-tabs +--attach-inlines +--attach-classes +--attach-namespaces + +### Settings ### +--style=kr +--indent=spaces=4 +--indent-namespaces +--lineend=linux +--min-conditional-indent=0 diff --git a/runastyle b/runastyle index 074a24186..19fb92234 100755 --- a/runastyle +++ b/runastyle @@ -17,28 +17,27 @@ if [[ "$DETECTED_VERSION" != ${ASTYLE_VERSION}* ]]; then exit 1; fi -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" +RCFILE=.astylerc -$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 -$ASTYLE $style $options test/cfg/*.c -$ASTYLE $style $options test/cfg/*.cpp -$ASTYLE $style $options test/*.h +$ASTYLE --options=$RCFILE cli/*.cpp +$ASTYLE --options=$RCFILE cli/*.h +$ASTYLE --options=$RCFILE democlient/*.cpp +$ASTYLE --options=$RCFILE gui/*.cpp +$ASTYLE --options=$RCFILE gui/*.h +$ASTYLE --options=$RCFILE -r gui/test/*.cpp +$ASTYLE --options=$RCFILE -r gui/test/*.h +$ASTYLE --options=$RCFILE lib/*.cpp +$ASTYLE --options=$RCFILE lib/*.h +$ASTYLE --options=$RCFILE test/*.cpp +$ASTYLE --options=$RCFILE test/cfg/*.c +$ASTYLE --options=$RCFILE test/cfg/*.cpp +$ASTYLE --options=$RCFILE test/*.h -$ASTYLE $style $options --recursive "tools/*.cpp" -$ASTYLE $style $options --recursive "tools/*.h" +$ASTYLE --options=$RCFILE --recursive "tools/*.cpp" +$ASTYLE --options=$RCFILE --recursive "tools/*.h" -$ASTYLE $style $options --recursive "samples/*.c" -$ASTYLE $style $options --recursive "samples/*.cpp" +$ASTYLE --options=$RCFILE --recursive "samples/*.c" +$ASTYLE --options=$RCFILE --recursive "samples/*.cpp" # Convert tabs to spaces.. even in strings # sed -i "s/\t/ /g" test/test*.cpp diff --git a/runastyle.bat b/runastyle.bat index 9b28eae59..dc1810457 100644 --- a/runastyle.bat +++ b/runastyle.bat @@ -19,28 +19,27 @@ GOTO EXIT_ERROR ) -@SET STYLE=--style=kr --indent=spaces=4 --indent-namespaces --lineend=linux --min-conditional-indent=0 -@SET OPTIONS=--pad-header --unpad-paren --suffix=none --convert-tabs --attach-inlines --attach-classes --attach-namespaces +@SET RCFILE=.astylerc -%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 -%ASTYLE% %STYLE% %OPTIONS% test/cfg/*.c -%ASTYLE% %STYLE% %OPTIONS% test/cfg/*.cpp -%ASTYLE% %STYLE% %OPTIONS% test/*.h +%ASTYLE% --options=%RCFILE% cli/*.cpp +%ASTYLE% --options=%RCFILE% cli/*.h +%ASTYLE% --options=%RCFILE% democlient/*.cpp +%ASTYLE% --options=%RCFILE% gui/*.cpp +%ASTYLE% --options=%RCFILE% gui/*.h +%ASTYLE% --options=%RCFILE% -r gui/test/*.cpp +%ASTYLE% --options=%RCFILE% -r gui/test/*.h +%ASTYLE% --options=%RCFILE% lib/*.cpp +%ASTYLE% --options=%RCFILE% lib/*.h +%ASTYLE% --options=%RCFILE% test/*.cpp +%ASTYLE% --options=%RCFILE% test/cfg/*.c +%ASTYLE% --options=%RCFILE% test/cfg/*.cpp +%ASTYLE% --options=%RCFILE% test/*.h -%ASTYLE% %STYLE% %OPTIONS% -r tools/*.cpp -%ASTYLE% %STYLE% %OPTIONS% -r tools/*.h +%ASTYLE% --options=%RCFILE% -r tools/*.cpp +%ASTYLE% --options=%RCFILE% -r tools/*.h -%ASTYLE% %STYLE% %OPTIONS% -r samples/*.c -%ASTYLE% %STYLE% %OPTIONS% -r samples/*.cpp +%ASTYLE% --options=%RCFILE% -r samples/*.c +%ASTYLE% --options=%RCFILE% -r samples/*.cpp @REM Format configuration files @SET XMLLINT=xmllint