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