| author | hoelzl | 
| Thu, 02 Sep 2010 19:57:16 +0200 | |
| changeset 39098 | 21e9bd6cf0a8 | 
| parent 33915 | 44a10fe6bd10 | 
| child 42077 | 96c50a4210a2 | 
| 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  | 
|
| 
32390
 
468eff174a77
function splitarray: splightly more abstract version that accomodates older bashes;
 
wenzelm 
parents: 
32322 
diff
changeset
 | 
20  | 
splitarray ":" "$ISABELLE_TOOLS"; TOOLS=("${SPLITARRAY[@]}")
 | 
| 
32322
 
45cb4a86eca2
change IFS only locally -- thanks to bash arrays;
 
wenzelm 
parents: 
28934 
diff
changeset
 | 
21  | 
|
| 
28504
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
22  | 
|
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
23  | 
## diagnostics  | 
| 2292 | 24  | 
|
| 
28504
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
25  | 
function usage()  | 
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
26  | 
{
 | 
| 
 
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 "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
 | 
29  | 
echo  | 
| 28506 | 30  | 
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
 | 
31  | 
echo  | 
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
32  | 
echo " Available tools are:"  | 
| 
33915
 
44a10fe6bd10
proper quoting of array expansion -- allow spaces in components;
 
wenzelm 
parents: 
32390 
diff
changeset
 | 
33  | 
  for DIR in "${TOOLS[@]}"
 | 
| 
32322
 
45cb4a86eca2
change IFS only locally -- thanks to bash arrays;
 
wenzelm 
parents: 
28934 
diff
changeset
 | 
34  | 
do  | 
| 
 
45cb4a86eca2
change IFS only locally -- thanks to bash arrays;
 
wenzelm 
parents: 
28934 
diff
changeset
 | 
35  | 
if [ -d "$DIR" ]; then  | 
| 
 
45cb4a86eca2
change IFS only locally -- thanks to bash arrays;
 
wenzelm 
parents: 
28934 
diff
changeset
 | 
36  | 
for TOOL in "$DIR"/*  | 
| 
 
45cb4a86eca2
change IFS only locally -- thanks to bash arrays;
 
wenzelm 
parents: 
28934 
diff
changeset
 | 
37  | 
do  | 
| 
 
45cb4a86eca2
change IFS only locally -- thanks to bash arrays;
 
wenzelm 
parents: 
28934 
diff
changeset
 | 
38  | 
if [ -f "$TOOL" -a -x "$TOOL" ]; then  | 
| 
 
45cb4a86eca2
change IFS only locally -- thanks to bash arrays;
 
wenzelm 
parents: 
28934 
diff
changeset
 | 
39  | 
NAME="$(basename "$TOOL")"  | 
| 
 
45cb4a86eca2
change IFS only locally -- thanks to bash arrays;
 
wenzelm 
parents: 
28934 
diff
changeset
 | 
40  | 
DESCRLINE="$(fgrep DESCRIPTION: "$TOOL" | sed -e 's/^.*DESCRIPTION: *//')"  | 
| 
 
45cb4a86eca2
change IFS only locally -- thanks to bash arrays;
 
wenzelm 
parents: 
28934 
diff
changeset
 | 
41  | 
echo " $NAME - $DESCRLINE"  | 
| 
 
45cb4a86eca2
change IFS only locally -- thanks to bash arrays;
 
wenzelm 
parents: 
28934 
diff
changeset
 | 
42  | 
fi  | 
| 
 
45cb4a86eca2
change IFS only locally -- thanks to bash arrays;
 
wenzelm 
parents: 
28934 
diff
changeset
 | 
43  | 
done  | 
| 
 
45cb4a86eca2
change IFS only locally -- thanks to bash arrays;
 
wenzelm 
parents: 
28934 
diff
changeset
 | 
44  | 
fi  | 
| 
 
45cb4a86eca2
change IFS only locally -- thanks to bash arrays;
 
wenzelm 
parents: 
28934 
diff
changeset
 | 
45  | 
done  | 
| 
28504
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
46  | 
exit 1  | 
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
47  | 
}  | 
| 9786 | 48  | 
|
| 
28504
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
49  | 
function fail()  | 
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
50  | 
{
 | 
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
51  | 
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
 | 
52  | 
exit 2  | 
| 
 
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  | 
|
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
55  | 
|
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
56  | 
## args  | 
| 
 
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  | 
[ "$#" -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
 | 
59  | 
|
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
60  | 
TOOLNAME="$1"  | 
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
61  | 
shift  | 
| 
 
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  | 
|
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
64  | 
## main  | 
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
65  | 
|
| 
32322
 
45cb4a86eca2
change IFS only locally -- thanks to bash arrays;
 
wenzelm 
parents: 
28934 
diff
changeset
 | 
66  | 
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
 | 
67  | 
do  | 
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
68  | 
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
 | 
69  | 
[ -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
 | 
70  | 
done  | 
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
71  | 
|
| 
 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 
wenzelm 
parents: 
15967 
diff
changeset
 | 
72  | 
fail "Unknown Isabelle tool: $TOOLNAME"  |