Admin/isatest/isatest-lint
author haftmann
Thu, 18 Nov 2010 17:01:15 +0100
changeset 40602 91e583511113
parent 31582 4753c317d5c1
permissions -rw-r--r--
map_fun combinator in theory Fun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22410
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     1
#!/usr/bin/env perl
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     2
#
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     3
# Author: Florian Haftmann, TUM
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     4
#
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     5
# Do consistency and quality checks on the isabelle sources
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     6
#
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     7
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     8
use strict;
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
     9
use File::Find;
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    10
use File::Basename;
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    11
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    12
# configuration
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    13
my $isabelleRoot = $ENV{'HOME'} . "/isabelle";
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    14
my @suffices = ('\.thy', '\.ml', '\.ML');
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    15
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    16
# lint main procedure
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    17
sub lint() {
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    18
    my ($basename, $dirname, $ext) = fileparse($File::Find::name, @suffices);
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    19
    if ($ext) {
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    20
        open ISTREAM, $File::Find::name or die("error opening $File::Find::name");
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    21
        my $found = 0;
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    22
        while (<ISTREAM>) {
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    23
            $found ||= m/\$Id[^\$]*\$/;
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    24
            last if $found;
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    25
        }
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    26
        close ISTREAM;
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    27
        my $relname = substr($File::Find::name, (length $isabelleRoot) + 1);
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    28
        if (! $found) {
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    29
            print "Found no CVS id in $relname\n";
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    30
        }
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    31
    }
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    32
}
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    33
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    34
# first argument =^= isabelle repository root
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    35
if (@ARGV) {
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    36
    $isabelleRoot = $ARGV[0];
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    37
}
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    38
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    39
find(\&lint, $isabelleRoot);
da313b67a04d moved all isatest/cron job related files to own directory
kleing
parents:
diff changeset
    40