diff --git a/contrib/utilities/astyle.rc b/contrib/utilities/astyle.rc new file mode 100644 index 0000000..39b789c --- /dev/null +++ b/contrib/utilities/astyle.rc @@ -0,0 +1,15 @@ +# astyle indentation style for FDPS SPH +# Run astyle on all files with: +# astyle --options=contrib/utilities/astyle.rc `find src | egrep '\.(h|cc)$'` + +--style=google + +# use tabs: +--indent-preprocessor +--indent=tab +--indent-namespaces +--indent-labels + +--max-instatement-indent=80 +--suffix=none +--quiet diff --git a/contrib/utilities/indent b/contrib/utilities/indent new file mode 100755 index 0000000..af0ded0 --- /dev/null +++ b/contrib/utilities/indent @@ -0,0 +1,29 @@ +#!/bin/bash + +if test ! -d src ; then + echo "*** This script must be run from the top-level directory of FDPS SPH." + exit +fi + +if test ! -f contrib/utilities/astyle.rc ; then + echo "*** No style file doc/astyle.rc found." + exit +fi + +if test -z "`which astyle`" ; then + echo "*** No astyle program found." + exit +fi + +if test "`astyle --version 2>&1`" != "Artistic Style Version 3.1" ; then + echo "*** Found a version of astyle different than the required version 3.1." + exit +fi + + +echo "--- Indenting all FDPS SPH files" + +find src \( -name '*.cc' -o -name '*.h' \) -print | xargs -n 50 -P 10 astyle --options=contrib/utilities/astyle.rc + +# remove execute permission on source files: +find src \( -name '*.cc' -o -name '*.h' \) -print | xargs -n 50 -P 10 chmod -x