bin/isabelle
author haftmann
Sun, 01 Jan 2012 15:44:15 +0100
changeset 46128 53e7cc599f58
parent 42124 7519c7c33017
child 48858 86816c61b5ca
permissions -rwxr-xr-x
interaction of set operations for execution and membership predicate
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10555
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10511
diff changeset
     1
#!/usr/bin/env bash
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
     2
#
9786
wenzelm
parents: 8359
diff changeset
     3
# Author: Markus Wenzel, TU Muenchen
2308
641be5ad47af improved 'not found' messages;
wenzelm
parents: 2292
diff changeset
     4
#
28504
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
     5
# Isabelle tool wrapper.
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
     6
15843
d5bd4a18ce70 improved handling of symlinks;
wenzelm
parents: 15784
diff changeset
     7
if [ -L "$0" ]; then
d5bd4a18ce70 improved handling of symlinks;
wenzelm
parents: 15784
diff changeset
     8
  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
15967
f9163c6f69d6 proper treatment of directory links;
wenzelm
parents: 15864
diff changeset
     9
  exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
15843
d5bd4a18ce70 improved handling of symlinks;
wenzelm
parents: 15784
diff changeset
    10
fi
d5bd4a18ce70 improved handling of symlinks;
wenzelm
parents: 15784
diff changeset
    11
28504
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    12
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    13
## settings
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    14
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    15
PRG="$(basename "$0")"
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    16
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    17
ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    18
source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    19
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    20
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    21
## diagnostics
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    22
28504
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    23
function usage()
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    24
{
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    25
  echo
28506
3ab515ee4e6f tuned isabelle usage;
wenzelm
parents: 28504
diff changeset
    26
  echo "Usage: $PRG NAME [ARGS ...]"
28504
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    27
  echo
28506
3ab515ee4e6f tuned isabelle usage;
wenzelm
parents: 28504
diff changeset
    28
  echo "  Start Isabelle tool NAME with ARGS; pass \"-?\" for tool specific help."
28504
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    29
  echo
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    30
  echo "  Available tools are:"
42077
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents: 33915
diff changeset
    31
  perl -w "$ISABELLE_HOME/lib/scripts/tools.pl"
28504
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    32
  exit 1
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    33
}
9786
wenzelm
parents: 8359
diff changeset
    34
28504
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    35
function fail()
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    36
{
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    37
  echo "$1" >&2
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    38
  exit 2
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    39
}
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    40
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    41
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    42
## args
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    43
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    44
[ "$#" -lt 1 -o "$1" = "-?" ] && usage
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    45
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    46
TOOLNAME="$1"
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    47
shift
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    48
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    49
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    50
## main
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    51
42077
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents: 33915
diff changeset
    52
splitarray ":" "$ISABELLE_TOOLS"; TOOLS=("${SPLITARRAY[@]}")
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents: 33915
diff changeset
    53
32322
45cb4a86eca2 change IFS only locally -- thanks to bash arrays;
wenzelm
parents: 28934
diff changeset
    54
for DIR in "${TOOLS[@]}"
28504
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    55
do
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    56
  TOOL="$DIR/$TOOLNAME"
42077
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents: 33915
diff changeset
    57
  case "$TOOL" in
42124
7519c7c33017 suppress Mercurial backup files;
wenzelm
parents: 42077
diff changeset
    58
    *~ | *.orig) ;;
42077
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents: 33915
diff changeset
    59
    *) [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@" ;;
96c50a4210a2 list Isabelle tools via perl script, which is much faster that bash plumbing, especially on Cygwin;
wenzelm
parents: 33915
diff changeset
    60
  esac
28504
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    61
done
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    62
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    63
fail "Unknown Isabelle tool: $TOOLNAME"