Location: LEMON/LEMON-main/scripts/unify-sources.sh - annotation
Load file history
Using from-to order in graph copying tools + doc improvements (ticket #150)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 r208:4317d277ba21 | #!/bin/bash
YEAR=`date +2003-%Y`
HGROOT=`hg root`
function update_header() {
TMP_FILE=`mktemp`
FILE_NAME=$1
(echo "/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) "$YEAR"
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided \"AS IS\" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
"
awk 'BEGIN { pm=0; }
pm==3 { print }
/\/\* / && pm==0 { pm=1;}
/[^:blank:]/ && (pm==0 || pm==2) { pm=3; print;}
/\*\// && pm==1 { pm=2;}
' $1
) >$TMP_FILE
HEADER_CH=`diff -q $TMP_FILE $FILE_NAME >/dev/null&&echo NO||echo YES`
rm $FILE_NAME
mv $TMP_FILE $FILE_NAME
}
function update_tabs() {
TMP_FILE=`mktemp`
FILE_NAME=$1
cat $1 |
sed -e 's/\t/ /g' >$TMP_FILE
TABS_CH=`diff -q $TMP_FILE $FILE_NAME >/dev/null&&echo NO||echo YES`
rm $FILE_NAME
mv $TMP_FILE $FILE_NAME
}
function remove_trailing_space() {
TMP_FILE=`mktemp`
FILE_NAME=$1
cat $1 |
sed -e 's/ \+$//g' >$TMP_FILE
SPACES_CH=`diff -q $TMP_FILE $FILE_NAME >/dev/null&&echo NO||echo YES`
rm $FILE_NAME
mv $TMP_FILE $FILE_NAME
}
function long_line_test() {
cat $1 |grep -q -E '.{81,}'
}
function update_file() {
echo -n ' update' $i ...
update_header $1
update_tabs $1
remove_trailing_space $1
CHANGED=NO;
if [[ $HEADER_CH = YES ]];
then
echo -n ' [header updated]'
CHANGED=YES;
fi
if [[ $TABS_CH = YES ]];
then
echo -n ' [tabs removed]'
CHANGED=YES;
fi
if [[ $SPACES_CH = YES ]];
then
echo -n ' [trailing spaces removed]'
CHANGED=YES;
fi
if long_line_test $1 ;
then
echo -n ' [LONG LINES]'
((LONG_LINE_FILES++))
fi
echo
if [[ $CHANGED = YES ]];
then
((CHANGED_FILES++))
fi
}
CHANGED_FILES=0
TOTAL_FILES=0
LONG_LINE_FILES=0
if [ $# == 0 ]; then
echo Update all source files...
for i in `hg manifest|grep -E '\.(cc|h|dox)$'`
do
update_file $HGROOT/$i
((TOTAL_FILES++))
done
echo ' done.'
else
for i in $*
do
update_file $i
((TOTAL_FILES++))
done
fi
echo $CHANGED_FILES out of $TOTAL_FILES files has been changed.
if [[ $LONG_LINE_FILES -gt 1 ]]; then
echo
echo WARNING: $LONG_LINE_FILES files contains long lines!
echo
elif [[ $LONG_LINE_FILES -gt 0 ]]; then
echo
echo WARNING: a file contains long lines!
echo
fi
|