25632
|
1 |
#!/usr/bin/env bash
|
|
2 |
#
|
|
3 |
# $Id$
|
|
4 |
# Author: Markus Wenzel, TU Muenchen
|
|
5 |
#
|
|
6 |
# DESCRIPTION: run Isabelle process with plain tty interaction
|
|
7 |
|
|
8 |
PRG="$(basename "$0")"
|
|
9 |
|
|
10 |
function usage()
|
|
11 |
{
|
|
12 |
echo
|
|
13 |
echo "Usage: $PRG [OPTIONS]"
|
|
14 |
echo
|
|
15 |
echo " Options are:"
|
25633
|
16 |
echo " -l NAME logic image name (default ISABELLE_LOGIC=\"$ISABELLE_LOGIC\")"
|
25632
|
17 |
echo " -m MODE add print mode for output"
|
|
18 |
echo " -p NAME line editor program name"
|
25633
|
19 |
echo " (default ISABELLE_LINE_EDITOR=\"$ISABELLE_LINE_EDITOR\")"
|
25632
|
20 |
echo
|
|
21 |
echo " Run Isabelle process with plain tty interaction, and optional line editor."
|
|
22 |
echo
|
|
23 |
exit 1
|
|
24 |
}
|
|
25 |
|
|
26 |
function fail()
|
|
27 |
{
|
|
28 |
echo "$1" >&2
|
|
29 |
exit 2
|
|
30 |
}
|
|
31 |
|
|
32 |
|
|
33 |
## process command line
|
|
34 |
|
|
35 |
# options
|
|
36 |
|
|
37 |
ISABELLE_OPTIONS="-I"
|
|
38 |
LOGIC=""
|
|
39 |
LINE_EDITOR="$ISABELLE_LINE_EDITOR"
|
|
40 |
|
|
41 |
while getopts "l:m:p:" OPT
|
|
42 |
do
|
|
43 |
case "$OPT" in
|
|
44 |
l)
|
|
45 |
LOGIC="$OPTARG"
|
|
46 |
;;
|
|
47 |
m)
|
25637
|
48 |
ISABELLE_OPTIONS="$ISABELLE_OPTIONS -m $OPTARG"
|
25632
|
49 |
;;
|
|
50 |
p)
|
|
51 |
LINE_EDITOR="$OPTARG"
|
|
52 |
;;
|
|
53 |
\?)
|
|
54 |
usage
|
|
55 |
;;
|
|
56 |
esac
|
|
57 |
done
|
|
58 |
|
|
59 |
shift $(($OPTIND - 1))
|
|
60 |
|
|
61 |
|
|
62 |
# args
|
|
63 |
|
|
64 |
[ "$#" -ne 0 ] && { echo "Bad args: $*"; usage; }
|
|
65 |
|
|
66 |
|
|
67 |
## main
|
|
68 |
|
|
69 |
if [ -n "$LINE_EDITOR" ]; then
|
|
70 |
exec "$LINE_EDITOR" "$ISABELLE" $ISABELLE_OPTIONS "$LOGIC"
|
|
71 |
else
|
|
72 |
exec "$ISABELLE" $ISABELLE_OPTIONS "$LOGIC"
|
|
73 |
fi
|