author | haftmann |
Sun, 01 Jan 2012 15:44:15 +0100 | |
changeset 46128 | 53e7cc599f58 |
parent 42124 | 7519c7c33017 |
child 48858 | 86816c61b5ca |
permissions | -rwxr-xr-x |
10555 | 1 |
#!/usr/bin/env bash |
2292 | 2 |
# |
9786 | 3 |
# Author: Markus Wenzel, TU Muenchen |
2308 | 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 | 6 |
|
15843 | 7 |
if [ -L "$0" ]; then |
8 |
TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')" |
|
15967 | 9 |
exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@" |
15843 | 10 |
fi |
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 | 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 | 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 | 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 | 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 | 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" |