0c33a074a71bf90521b6ac9ca28ded0ce766c2b9
1 # Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
2 # Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
3 # This file is part of Coccinelle.
5 # Coccinelle is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, according to version 2 of the License.
9 # Coccinelle is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
17 # The authors reserve the right to distribute this or future versions of
18 # Coccinelle under other licenses.
23 # ARGV: 0 = replacement text, 1 = file w. list of files
27 $retain = 1; # 1 = retain old status
29 #----------------------------------------------------------------------
30 $header = 0; # 0 = not seen header yet; 1 = seen beginning; 2 = seen end
37 # Get replacement text
40 # Get files of interest
45 # Remove file name suffixes
49 print "--> added [$_]\n" if $debug;
55 # Find an ignore header
57 $header = $header + 1;
64 if(/^([0-9a-zA-Z_-]+)\.c\s*$/) {
67 print "--> currentfile: [$currentfile]\n" if $debug;
71 if(/^(\s+\*\s+)\[status\]([ \t\f]*)(\S*)$/) {
74 print "--> $currentfile [$currentstatus]\n" if $debug;
76 if(grep {/^$currentfile$/} @files) {
77 s/^(\s+\*\s+\[status\])[ \t\f]*(.*)$/\1 $replace/;
78 print "==>" if $debug;
80 if($retain && ($currentstatus ne "")) {
81 $oldstatus = " * [old-status] $currentstatus\n";
94 if($oldstatus ne "") {