bin/isabelle
author krauss
Mon, 27 Jul 2009 21:47:41 +0200
changeset 32235 8f9b8d14fc9f
parent 28934 801098c96f59
child 32322 45cb4a86eca2
permissions -rwxr-xr-x
"more standard" argument order of relation composition (op O)
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:"
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    31
  (
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    32
    ORIG_IFS="$IFS"
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    33
    IFS=":"
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    34
    for DIR in $ISABELLE_TOOLS
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    35
    do
28934
801098c96f59 proper check of ISABELLE_TOOLS directories;
wenzelm
parents: 28506
diff changeset
    36
      if [ -d "$DIR" ]; then
801098c96f59 proper check of ISABELLE_TOOLS directories;
wenzelm
parents: 28506
diff changeset
    37
        cd "$DIR"
801098c96f59 proper check of ISABELLE_TOOLS directories;
wenzelm
parents: 28506
diff changeset
    38
        for T in *
801098c96f59 proper check of ISABELLE_TOOLS directories;
wenzelm
parents: 28506
diff changeset
    39
        do
801098c96f59 proper check of ISABELLE_TOOLS directories;
wenzelm
parents: 28506
diff changeset
    40
          if [ -f "$T" -a -x "$T" ]; then
801098c96f59 proper check of ISABELLE_TOOLS directories;
wenzelm
parents: 28506
diff changeset
    41
            DESCRLINE=$(fgrep DESCRIPTION: "$T" | sed -e 's/^.*DESCRIPTION: *//')
801098c96f59 proper check of ISABELLE_TOOLS directories;
wenzelm
parents: 28506
diff changeset
    42
            echo "    $T - $DESCRLINE"
801098c96f59 proper check of ISABELLE_TOOLS directories;
wenzelm
parents: 28506
diff changeset
    43
          fi
801098c96f59 proper check of ISABELLE_TOOLS directories;
wenzelm
parents: 28506
diff changeset
    44
        done
801098c96f59 proper check of ISABELLE_TOOLS directories;
wenzelm
parents: 28506
diff changeset
    45
      fi
28504
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    46
    done
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    47
    IFS="$ORIG_IFS"
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
  exit 1
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    50
}
9786
wenzelm
parents: 8359
diff changeset
    51
28504
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    52
function fail()
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    53
{
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    54
  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
    55
  exit 2
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    56
}
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    57
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    58
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    59
## args
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    60
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    61
[ "$#" -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
    62
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    63
TOOLNAME="$1"
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    64
shift
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    65
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    66
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    67
## main
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    68
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    69
ORIG_IFS="$IFS"
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    70
IFS=":"
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    71
for DIR in $ISABELLE_TOOLS
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    72
do
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    73
  TOOL="$DIR/$TOOLNAME"
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    74
  [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@"
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    75
done
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    76
IFS="$ORIG_IFS"
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    77
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 15967
diff changeset
    78
fail "Unknown Isabelle tool: $TOOLNAME"