#!/bin/bash12# This file is part of t8code.3# t8code is a C library to manage a collection (a forest) of multiple4# connected adaptive space-trees of general element classes in parallel.5#6# Copyright (C) 2023 the developers7#8# t8code is free software; you can redistribute it and/or modify9# it under the terms of the GNU General Public License as published by10# the Free Software Foundation; either version 2 of the License, or11# (at your option) any later version.12#13# t8code is distributed in the hope that it will be useful,14# but WITHOUT ANY WARRANTY; without even the implied warranty of15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16# GNU General Public License for more details.17#18# You should have received a copy of the GNU General Public License19# along with t8code; if not, write to the Free Software Foundation, Inc.,20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.2122# This script indents all .c .h .cxx and .hxx23# files in t8code.24#25# Returns 0 if yes and not 0 if not.26#2728#29# This script must be executed from the scripts/ folder.30#31if [ `basename $PWD` != scripts ]32then33if [ -d scripts ]34then35# The directory stack is automatically reset on script exit.36pushd scripts/ > /dev/null37else38echo ERROR: scripts/ directory not found.39exit 140fi41fi4243# Find all files with the appropriate suffix.44# Excluding the sc/ and p4est/ subfolders.45files=`./find_all_source_files.sh`4647notallindented=04849INDENT=./t8indent.sh5051echo This script will change all source files found in52echo $PWD/../src/53echo $PWD/../example/54echo $PWD/../test/55echo $PWD/../tutorials/56echo $PWD/../benchmarks/57echo $PWD/../api/58echo $PWD/../mesh_handle/59echo60read -p "Are you sure? ('Y' or 'y' to continue)" -n 1 -r61echo62if [[ $REPLY =~ ^[Yy]$ ]]63then64echo Indenting all files...65for file in $files66do67# Find also give as directories,68# so we ensure that $file is a proper69# file before checking for indentation.70if [ -f $file ]71then72$INDENT $file73status=$?74if test $status -ne 075then76echo "File $file is not indented."77notallindented=178fi79fi80done8182if test $notallindented -eq 083then84echo All files are indented.85fi86echo done.87else88echo Aborted.89fi9091exit $notallindented929394