author | wenzelm |
Sat, 28 Mar 2015 17:26:42 +0100 | |
changeset 59828 | 0e9baaf0e0bb |
parent 57686 | 5b16e2370ccb |
child 61135 | 8f7d802b7a71 |
permissions | -rwxr-xr-x |
25632 | 1 |
#!/usr/bin/env bash |
2 |
# |
|
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
3 |
# Author: Makarius |
25632 | 4 |
# |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
5 |
# DESCRIPTION: run Isabelle process with raw ML console and line editor |
25632 | 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:" |
|
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
15 |
echo " -d DIR include session directory" |
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
16 |
echo " -l NAME logic session name (default ISABELLE_LOGIC=\"$ISABELLE_LOGIC\")" |
25632 | 17 |
echo " -m MODE add print mode for output" |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
18 |
echo " -n no build of session image on startup" |
52062 | 19 |
echo " -o OPTION override Isabelle system OPTION (via NAME=VAL or NAME)" |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
20 |
echo " -s system build mode for session image" |
25632 | 21 |
echo |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
22 |
echo " Run Isabelle process with raw ML console and line editor" |
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
23 |
echo " (ISABELLE_LINE_EDITOR=\"$ISABELLE_LINE_EDITOR\")." |
25632 | 24 |
echo |
25 |
exit 1 |
|
26 |
} |
|
27 |
||
28 |
||
29 |
## process command line |
|
30 |
||
31 |
# options |
|
32 |
||
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
33 |
declare -a ISABELLE_OPTIONS=() |
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
34 |
|
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
35 |
declare -a INCLUDE_DIRS=() |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
36 |
LOGIC="$ISABELLE_LOGIC" |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
37 |
NO_BUILD="false" |
57581
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
38 |
declare -a SYSTEM_OPTIONS=() |
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
39 |
SYSTEM_MODE="false" |
25632 | 40 |
|
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
41 |
while getopts "d:l:m:no:s" OPT |
25632 | 42 |
do |
43 |
case "$OPT" in |
|
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
44 |
d) |
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
45 |
INCLUDE_DIRS["${#INCLUDE_DIRS[@]}"]="$OPTARG" |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
46 |
;; |
25632 | 47 |
l) |
48 |
LOGIC="$OPTARG" |
|
49 |
;; |
|
50 |
m) |
|
52062 | 51 |
ISABELLE_OPTIONS["${#ISABELLE_OPTIONS[@]}"]="-m" |
52 |
ISABELLE_OPTIONS["${#ISABELLE_OPTIONS[@]}"]="$OPTARG" |
|
53 |
;; |
|
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
54 |
n) |
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
55 |
NO_BUILD="true" |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
56 |
;; |
52062 | 57 |
o) |
57581
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
58 |
SYSTEM_OPTIONS["${#SYSTEM_OPTIONS[@]}"]="$OPTARG" |
25632 | 59 |
;; |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
60 |
s) |
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
61 |
SYSTEM_MODE="true" |
25632 | 62 |
;; |
63 |
\?) |
|
64 |
usage |
|
65 |
;; |
|
66 |
esac |
|
67 |
done |
|
68 |
||
69 |
shift $(($OPTIND - 1)) |
|
70 |
||
71 |
||
72 |
# args |
|
73 |
||
74 |
[ "$#" -ne 0 ] && { echo "Bad args: $*"; usage; } |
|
75 |
||
76 |
||
77 |
## main |
|
78 |
||
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
79 |
isabelle_admin_build jars || exit $? |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
80 |
|
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
81 |
declare -a JAVA_ARGS; eval "JAVA_ARGS=($ISABELLE_BUILD_JAVA_OPTIONS)" |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
82 |
|
57686 | 83 |
mkdir -p "$ISABELLE_TMP_PREFIX" || exit $? |
57581
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
84 |
OPTIONS_FILE="$ISABELLE_TMP_PREFIX/options$$" |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
85 |
|
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
86 |
"$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" isabelle.Build_Console \ |
57581
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
87 |
"$LOGIC" "$NO_BUILD" "$SYSTEM_MODE" "$OPTIONS_FILE" \ |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
88 |
"${INCLUDE_DIRS[@]}" $'\n' "${SYSTEM_OPTIONS[@]}" || { |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
89 |
rm -f "$OPTIONS_FILE" |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
90 |
exit "$?" |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
91 |
} |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
92 |
|
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
93 |
ISABELLE_OPTIONS["${#ISABELLE_OPTIONS[@]}"]="-O" |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
94 |
ISABELLE_OPTIONS["${#ISABELLE_OPTIONS[@]}"]="$OPTIONS_FILE" |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
95 |
|
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
96 |
if type -p "$ISABELLE_LINE_EDITOR" > /dev/null |
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
97 |
then |
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
98 |
exec "$ISABELLE_LINE_EDITOR" "$ISABELLE_PROCESS" "${ISABELLE_OPTIONS[@]}" -- "$LOGIC" |
25632 | 99 |
else |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
100 |
echo "### No line editor: \"$ISABELLE_LINE_EDITOR\"" |
52062 | 101 |
exec "$ISABELLE_PROCESS" "${ISABELLE_OPTIONS[@]}" -- "$LOGIC" |
25632 | 102 |
fi |