author | wenzelm |
Sun, 20 Jul 2014 17:21:14 +0200 | |
changeset 57580 | 86b413b8f779 |
parent 57439 | 0e41f26a0250 |
child 57581 | 74bbe9317aa4 |
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" |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
38 |
declare -a BUILD_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) |
58 |
ISABELLE_OPTIONS["${#ISABELLE_OPTIONS[@]}"]="-o" |
|
59 |
ISABELLE_OPTIONS["${#ISABELLE_OPTIONS[@]}"]="$OPTARG" |
|
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
60 |
BUILD_OPTIONS["${#BUILD_OPTIONS[@]}"]="$OPTARG" |
25632 | 61 |
;; |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
62 |
s) |
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
63 |
SYSTEM_MODE="true" |
25632 | 64 |
;; |
65 |
\?) |
|
66 |
usage |
|
67 |
;; |
|
68 |
esac |
|
69 |
done |
|
70 |
||
71 |
shift $(($OPTIND - 1)) |
|
72 |
||
73 |
||
74 |
# args |
|
75 |
||
76 |
[ "$#" -ne 0 ] && { echo "Bad args: $*"; usage; } |
|
77 |
||
78 |
||
79 |
## main |
|
80 |
||
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
81 |
isabelle_admin_build jars || exit $? |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
82 |
|
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
83 |
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
|
84 |
|
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
85 |
"$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" isabelle.Build_Console \ |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
86 |
"$LOGIC" "$NO_BUILD" "$SYSTEM_MODE" \ |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
87 |
"${INCLUDE_DIRS[@]}" $'\n' "${BUILD_OPTIONS[@]}" || exit "$?" |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
88 |
|
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
89 |
if type -p "$ISABELLE_LINE_EDITOR" > /dev/null |
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
90 |
then |
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
91 |
exec "$ISABELLE_LINE_EDITOR" "$ISABELLE_PROCESS" "${ISABELLE_OPTIONS[@]}" -- "$LOGIC" |
25632 | 92 |
else |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
93 |
echo "### No line editor: \"$ISABELLE_LINE_EDITOR\"" |
52062 | 94 |
exec "$ISABELLE_PROCESS" "${ISABELLE_OPTIONS[@]}" -- "$LOGIC" |
25632 | 95 |
fi |