From 7b58455ff5c5c006a2661445303afc4741bba003 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Sat, 31 Jul 2010 17:28:24 +0300 Subject: [PATCH] Improve Astyle scripts to use variables. Using variables for style and options makes it easier to edit the scripts. Also avoids copy/paste errors when editing scripts. --- runastyle | 21 ++++++++++++--------- runastyle.bat | 22 +++++++++++++--------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/runastyle b/runastyle index f2e8cc3c4..eb1920442 100755 --- a/runastyle +++ b/runastyle @@ -1,13 +1,16 @@ #!/bin/bash -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren cli/*.cpp -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren cli/*.h -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren gui/*.cpp -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren gui/*.h -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren lib/*.cpp -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren lib/*.h -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren test/*.cpp -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren test/*.h +style="--style=ansi --min-conditional-indent=0" +options="--pad-header --unpad-paren" -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren tools/*.cpp +astyle $style $options cli/*.cpp +astyle $style $options cli/*.h +astyle $style $options gui/*.cpp +astyle $style $options gui/*.h +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 diff --git a/runastyle.bat b/runastyle.bat index 4cc0d62d3..0394eab51 100644 --- a/runastyle.bat +++ b/runastyle.bat @@ -1,12 +1,16 @@ +REM A script to run Astyle for the sources -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren cli/*.cpp -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren cli/*.h -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren gui/*.cpp -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren gui/*.h -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren lib/*.cpp -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren lib/*.h -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren test/*.cpp -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren test/*.h +SET STYLE=--style=ansi --min-conditional-indent=0 +SET OPTIONS=--pad-header --unpad-paren -astyle --style=ansi --min-conditional-indent=0 --pad-header --unpad-paren tools/*.cpp +astyle %STYLE% %OPTIONS% cli/*.cpp +astyle %STYLE% %OPTIONS% cli/*.h +astyle %STYLE% %OPTIONS% gui/*.cpp +astyle %STYLE% %OPTIONS% gui/*.h +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