lib/Tools/fixheaders
author wenzelm
Wed, 01 Feb 2006 22:20:40 +0100
changeset 18888 3b643f81b378
parent 16704 89cc9172f0be
child 26576 fc76b7b79ba9
permissions -rwxr-xr-x
updated;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16471
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
     1
#!/usr/bin/env bash
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
     2
#
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
     3
# $Id$
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
     4
# Author: Florian Haftmann, TUM
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
     5
#
16704
wenzelm
parents: 16471
diff changeset
     6
# DESCRIPTION: turn Isar theory headers into imports-uses-begin format
16471
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
     7
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
     8
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
     9
## diagnostics
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    10
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    11
PRG="$(basename "$0")"
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    12
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    13
function usage()
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    14
{
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    15
  echo
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    16
  echo "Usage: $PRG [FILES|DIRS...]"
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    17
  echo
16704
wenzelm
parents: 16471
diff changeset
    18
  echo "  Recursively find .thy files, turning Isar theory headers into"
wenzelm
parents: 16471
diff changeset
    19
  echo "  imports-uses-begin format."
16471
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    20
  echo
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    21
  echo "  Renames old versions of FILES by appending \"~~\"."
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    22
  echo
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    23
  exit 1
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    24
}
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    25
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    26
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    27
## process command line
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    28
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    29
[ "$#" -eq 0 -o "$1" = "-?" ] && usage
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    30
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    31
SPECS="$@"; shift "$#"
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    32
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    33
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    34
## main
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    35
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    36
#set by configure
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    37
AUTO_PERL=perl
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    38
16704
wenzelm
parents: 16471
diff changeset
    39
find $SPECS -name \*.thy -print | \
16471
c487e7e8865f added fixheaders
haftmann
parents:
diff changeset
    40
  xargs "$AUTO_PERL" -w "$ISABELLE_HOME/lib/scripts/fixheaders.pl"