summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2011-02-26 22:19:47 +0000
committerMorgan Deters <mdeters@gmail.com>2011-02-26 22:19:47 +0000
commit3548c7e5f6afed4e07bf9a70f0403952c9262519 (patch)
tree18f5ae49fe1ecdc9f3254074df0990dc1930fbf2 /contrib
parentedf6aaa87da179948e6b233d16fa37d2aea58bbb (diff)
Commit to fix bug 241 (improper "using namespace std" in a header). This caused a number of latent errors in sources and headers to come up. Those are now fixed (by adding "using" or "std::" depending on the context). Took the opportunity to bring many rewriter sources in line with coding conventions.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/update-copyright.pl192
1 files changed, 107 insertions, 85 deletions
diff --git a/contrib/update-copyright.pl b/contrib/update-copyright.pl
index 5cf543459..db3ac47da 100755
--- a/contrib/update-copyright.pl
+++ b/contrib/update-copyright.pl
@@ -2,7 +2,7 @@
#
# update-copyright.pl
# Morgan Deters <mdeters@cs.nyu.edu> for CVC4
-# Copyright (c) 2009, 2010 The CVC4 Project
+# Copyright (c) 2009, 2010, 2011 The CVC4 Project
#
# usage: update-copyright [ files/directories... ]
#
@@ -34,7 +34,7 @@ my $excluded_paths = '^src/parser/antlr_input_imports.cpp$';
# Years of copyright for the template. E.g., the string
# "1985, 1987, 1992, 1997, 2008" or "2006-2009" or whatever.
-my $years = '2009, 2010';
+my $years = '2009, 2010, 2011';
my $standard_template = <<EOF;
** This file is part of the CVC4 prototype.
@@ -91,7 +91,110 @@ EOF
print "Updating sources...\n";
-recurse(shift @searchdirs) while $#searchdirs >= 0;
+while($#searchdirs >= 0) {
+ my $dir = shift @searchdirs;
+ my $mode = (stat($dir))[2] || warn "file or directory \`$dir' does not exist!";
+ my $is_directory = S_ISDIR($mode);
+ if($is_directory) {
+ recurse($dir);
+ } else {
+ if($dir =~ m,^(.*)\/([^/]*)$,) {
+ my($dir, $file) = ($1, $2);
+ if($dir eq "") {
+ $dir = "/";
+ }
+ handleFile($dir, $file);
+ } else {
+ handleFile(".", $dir);
+ }
+ }
+}
+
+sub handleFile {
+ my ($srcdir, $file) = @_;
+ next if !($file =~ /\.(c|cc|cpp|C|h|hh|hpp|H|y|yy|ypp|Y|l|ll|lpp|L|g)$/);
+ next if ($srcdir.'/'.$file) =~ /$excluded_paths/;
+ print "$srcdir/$file...";
+ my $infile = $srcdir.'/'.$file;
+ my $outfile = $srcdir.'/#'.$file.'.tmp';
+ open(my $IN, $infile) || die "error opening $infile for reading";
+ open(my $OUT, '>', $outfile) || die "error opening $outfile for writing";
+ open(my $AUTHOR, "$dir/get-authors " . $infile . '|');
+ my $author = <$AUTHOR>; chomp $author;
+ my $major_contributors = <$AUTHOR>; chomp $major_contributors;
+ my $minor_contributors = <$AUTHOR>; chomp $minor_contributors;
+ close $AUTHOR;
+ $_ = <$IN>;
+ if(m,^(%{)?/\*(\*| )\*\*\*,) {
+ print "updating\n";
+ if($file =~ /\.(y|yy|ypp|Y)$/) {
+ print $OUT "%{/******************* */\n";
+ print $OUT "/** $file\n";
+ } elsif($file =~ /\.g$/) {
+ # avoid javadoc-style comment here; antlr complains
+ print $OUT "/* ******************* */\n";
+ print $OUT "/*! \\file $file\n";
+ } else {
+ print $OUT "/********************* */\n";
+ print $OUT "/*! \\file $file\n";
+ }
+ print $OUT " ** \\verbatim\n";
+ print $OUT " ** Original author: $author\n";
+ print $OUT " ** Major contributors: $major_contributors\n";
+ print $OUT " ** Minor contributors (to current version): $minor_contributors\n";
+ print $OUT $standard_template;
+ print $OUT " **\n";
+ while(my $line = <$IN>) {
+ last if $line =~ /^ \*\*\s*$/;
+ }
+ } else {
+ my $line = $_;
+ print "adding\n";
+ if($file =~ /\.(y|yy|ypp|Y)$/) {
+ print $OUT "%{/******************* */\n";
+ print $OUT "/*! \\file $file\n";
+ } elsif($file =~ /\.g$/) {
+ # avoid javadoc-style comment here; antlr complains
+ print $OUT "/* ******************* */\n";
+ print $OUT "/*! \\file $file\n";
+ } else {
+ print $OUT "/********************* */\n";
+ print $OUT "/*! \\file $file\n";
+ }
+ print $OUT " ** \\verbatim\n";
+ print $OUT " ** Original author: $author\n";
+ print $OUT " ** Major contributors: $major_contributors\n";
+ print $OUT " ** Minor contributors (to current version): $minor_contributors\n";
+ print $OUT $standard_template;
+ print $OUT " **\n";
+ print $OUT " ** \\brief [[ Add one-line brief description here ]]\n";
+ print $OUT " **\n";
+ print $OUT " ** [[ Add lengthier description here ]]\n";
+ print $OUT " ** \\todo document this file\n";
+ print $OUT " **/\n\n";
+ print $OUT $line;
+ if($file =~ /\.(y|yy|ypp|Y)$/) {
+ while(my $line = <$IN>) {
+ chomp $line;
+ if($line =~ '\s*%{(.*)') {
+ print $OUT "$1\n";
+ last;
+ }
+ # just in case something's weird with the file ?
+ if(!($line =~ '\s*')) {
+ print $OUT "$line\n";
+ last;
+ }
+ }
+ }
+ }
+ while(my $line = <$IN>) {
+ print $OUT $line;
+ }
+ close $IN;
+ close $OUT;
+ rename($outfile, $infile) || die "can't rename working file \`$outfile' to \`$infile'";
+}
sub recurse {
my ($srcdir) = @_;
@@ -106,88 +209,7 @@ sub recurse {
next if $file =~ /$excluded_directories/;
recurse($srcdir.'/'.$file);
} else {
- next if !($file =~ /\.(c|cc|cpp|C|h|hh|hpp|H|y|yy|ypp|Y|l|ll|lpp|L|g)$/);
- next if ($srcdir.'/'.$file) =~ /$excluded_paths/;
- print "$srcdir/$file...";
- my $infile = $srcdir.'/'.$file;
- my $outfile = $srcdir.'/#'.$file.'.tmp';
- open(my $IN, $infile) || die "error opening $infile for reading";
- open(my $OUT, '>', $outfile) || die "error opening $outfile for writing";
- open(my $AUTHOR, "$dir/get-authors " . $infile . '|');
- my $author = <$AUTHOR>; chomp $author;
- my $major_contributors = <$AUTHOR>; chomp $major_contributors;
- my $minor_contributors = <$AUTHOR>; chomp $minor_contributors;
- close $AUTHOR;
- $_ = <$IN>;
- if(m,^(%{)?/\*(\*| )\*\*\*,) {
- print "updating\n";
- if($file =~ /\.(y|yy|ypp|Y)$/) {
- print $OUT "%{/******************* */\n";
- print $OUT "/** $file\n";
- } elsif($file =~ /\.g$/) {
- # avoid javadoc-style comment here; antlr complains
- print $OUT "/* ******************* */\n";
- print $OUT "/*! \\file $file\n";
- } else {
- print $OUT "/********************* */\n";
- print $OUT "/*! \\file $file\n";
- }
- print $OUT " ** \\verbatim\n";
- print $OUT " ** Original author: $author\n";
- print $OUT " ** Major contributors: $major_contributors\n";
- print $OUT " ** Minor contributors (to current version): $minor_contributors\n";
- print $OUT $standard_template;
- print $OUT " **\n";
- while(my $line = <$IN>) {
- last if $line =~ /^ \*\*\s*$/;
- }
- } else {
- my $line = $_;
- print "adding\n";
- if($file =~ /\.(y|yy|ypp|Y)$/) {
- print $OUT "%{/******************* */\n";
- print $OUT "/*! \\file $file\n";
- } elsif($file =~ /\.g$/) {
- # avoid javadoc-style comment here; antlr complains
- print $OUT "/* ******************* */\n";
- print $OUT "/*! \\file $file\n";
- } else {
- print $OUT "/********************* */\n";
- print $OUT "/*! \\file $file\n";
- }
- print $OUT " ** \\verbatim\n";
- print $OUT " ** Original author: $author\n";
- print $OUT " ** Major contributors: $major_contributors\n";
- print $OUT " ** Minor contributors (to current version): $minor_contributors\n";
- print $OUT $standard_template;
- print $OUT " **\n";
- print $OUT " ** \\brief [[ Add one-line brief description here ]]\n";
- print $OUT " **\n";
- print $OUT " ** [[ Add lengthier description here ]]\n";
- print $OUT " ** \\todo document this file\n";
- print $OUT " **/\n\n";
- print $OUT $line;
- if($file =~ /\.(y|yy|ypp|Y)$/) {
- while(my $line = <$IN>) {
- chomp $line;
- if($line =~ '\s*%{(.*)') {
- print $OUT "$1\n";
- last;
- }
- # just in case something's weird with the file ?
- if(!($line =~ '\s*')) {
- print $OUT "$line\n";
- last;
- }
- }
- }
- }
- while(my $line = <$IN>) {
- print $OUT $line;
- }
- close $IN;
- close $OUT;
- rename($outfile, $infile) || die "can't rename working file \`$outfile' to \`$infile'";
+ handleFile($srcdir, $file);
}
}
closedir $DIR;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback