6 function update_header() {
10 (echo "/* -*- mode: C++; indent-tabs-mode: nil; -*-
12 * This file is a part of LEMON, a generic C++ optimization library.
14 * Copyright (C) "$YEAR"
15 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
16 * (Egervary Research Group on Combinatorial Optimization, EGRES).
18 * Permission to use, modify and distribute this software is granted
19 * provided that this copyright notice appears in all copies. For
20 * precise terms see the accompanying LICENSE file.
22 * This software is provided \"AS IS\" with no warranty of any kind,
23 * express or implied, and with no claim as to its suitability for any
30 /\/\* / && pm==0 { pm=1;}
31 /[^:blank:]/ && (pm==0 || pm==2) { pm=3; print;}
32 /\*\// && pm==1 { pm=2;}
36 HEADER_CH=`diff -q $TMP_FILE $FILE_NAME >/dev/null&&echo NO||echo YES`
39 mv $TMP_FILE $FILE_NAME
42 function update_tabs() {
47 sed -e 's/\t/ /g' >$TMP_FILE
49 TABS_CH=`diff -q $TMP_FILE $FILE_NAME >/dev/null&&echo NO||echo YES`
52 mv $TMP_FILE $FILE_NAME
55 function remove_trailing_space() {
60 sed -e 's/ \+$//g' >$TMP_FILE
62 SPACES_CH=`diff -q $TMP_FILE $FILE_NAME >/dev/null&&echo NO||echo YES`
65 mv $TMP_FILE $FILE_NAME
68 function long_line_test() {
69 cat $1 |grep -q -E '.{81,}'
72 function update_file() {
73 echo -n ' update' $i ...
77 remove_trailing_space $1
80 if [[ $HEADER_CH = YES ]];
82 echo -n ' [header updated]'
85 if [[ $TABS_CH = YES ]];
87 echo -n ' [tabs removed]'
90 if [[ $SPACES_CH = YES ]];
92 echo -n ' [trailing spaces removed]'
95 if long_line_test $1 ;
97 echo -n ' [LONG LINES]'
101 if [[ $CHANGED = YES ]];
111 echo Update all source files...
112 for i in `hg manifest|grep -E '\.(cc|h|dox)$'`
114 update_file $HGROOT/$i
125 echo $CHANGED_FILES out of $TOTAL_FILES files has been changed.
126 if [[ $LONG_LINE_FILES -gt 1 ]]; then
128 echo WARNING: $LONG_LINE_FILES files contains long lines!
130 elif [[ $LONG_LINE_FILES -gt 0 ]]; then
132 echo WARNING: a file contains long lines!