Skip to content

Commit

Permalink
Add script for indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gassmoeller committed Jul 11, 2019
1 parent e2eeb1c commit 7b3e02b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
15 changes: 15 additions & 0 deletions contrib/utilities/astyle.rc
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions contrib/utilities/indent
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7b3e02b

Please sign in to comment.