~luke-jr/tr2norigins/armagetron-0.2.8-t2o-accesslvls

« back to all changes in this revision

Viewing changes to batch/make/beautify

  • Committer: luke-jr
  • Date: 2006-05-29 01:55:42 UTC
  • Revision ID: svn-v3-list-QlpoOTFBWSZTWZvbKhsAAAdRgAAQABK6798QIABURMgAAaeoNT1TxT1DQbKaeobXKiyAmlWT7Y5MkdJOtXDtB7w7DOGFBHiOBxaUIu7HQyyQSvxdyRThQkJvbKhs:7d95bf1e-0414-0410-9756-b78462a59f44:armagetronad%2Fbranches%2F0.2.8%2Farmagetronad:4612
Unify tags/branches of modules released together

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Applies astyle on all source files
 
3
# usage: beautify <source directory> <tagfile> <astyle-options>
 
4
# if the sources should stay untouched or
 
5
# beautify -t <source directory> <tagfile> <astyle-options>
 
6
# if changed sources should be marked
 
7
 
 
8
# set -x
 
9
 
 
10
TOUCH=false
 
11
 
 
12
SRCDIR="$1"
 
13
shift
 
14
if test "$SRCDIR" == "-t"; then
 
15
    TOUCH=true
 
16
    SRCDIR="$1"
 
17
    shift
 
18
fi
 
19
 
 
20
TAGFILE=$SRCDIR/"$1"
 
21
shift
 
22
 
 
23
# mark tag file as really old file so everything will be beautified at first
 
24
test -r $TAGFILE || touch -t 198001010000 $TAGFILE
 
25
 
 
26
# find all edited source files
 
27
for f in `find $SRCDIR \( -name \*.cpp -o -name \*.h \) -a -cnewer $TAGFILE`; do
 
28
  echo "Beautifying $f"
 
29
 
 
30
  # copy and beautify
 
31
  cp $f $f.beautify
 
32
  astyle $f.beautify "$@"
 
33
 
 
34
  # test and touch/move back to original
 
35
  test "$TOUCH" = "false" && touch -r $f $f.beautify
 
36
  diff $f.beautify $f > /dev/null || mv $f.beautify $f
 
37
  rm -f $f.beautify*
 
38
done
 
39
 
 
40
# retouch tag file
 
41
rm -f $TAGFILE
 
42
echo "x" > $TAGFILE