lib/scripts/tools.pl
author haftmann
Wed, 28 Jan 2015 08:29:08 +0100
changeset 59456 180555df34ea
parent 48858 86816c61b5ca
permissions -rw-r--r--
string printing conformant to both (S)ML and Isabelle/ML
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42077
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
     1
#
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
     2
# Author: Makarius
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
     3
#
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
     4
# tools.pl - list Isabelle tools with description
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
     5
#
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
     6
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
     7
use strict;
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
     8
use warnings;
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
     9
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    10
my @tools = ();
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    11
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    12
for my $dir (split(":", $ENV{"ISABELLE_TOOLS"})) {
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    13
  if (-d $dir) {
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    14
    if (opendir DIR, $dir) {
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    15
      for my $name (readdir DIR) {
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    16
        my $file = "$dir/$name";
42124
7519c7c33017 suppress Mercurial backup files;
wenzelm
parents: 42077
diff changeset
    17
        if (-f $file and -x $file and !($file =~ /~$/ or $file =~ /\.orig$/)) {
42077
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    18
          if (open FILE, $file) {
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    19
            my $description;
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    20
            while (<FILE>) {
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    21
              if (!defined($description) and m/DESCRIPTION: *(.*)$/) {
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    22
                $description = $1;
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    23
              }
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    24
            }
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    25
            close FILE;
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    26
            if (defined($description)) {
48858
86816c61b5ca tuned message;
wenzelm
parents: 42124
diff changeset
    27
              push(@tools, "  $name - $description\n");
42077
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    28
            }
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    29
          }
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    30
        }
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    31
      }
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    32
      closedir DIR;
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    33
    }
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    34
  }
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    35
}
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    36
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents:
diff changeset
    37
for (sort @tools) { print };