author | wenzelm |
Tue, 29 Dec 2015 15:05:08 +0100 | |
changeset 61958 | 0a5dd617a88c |
parent 61135 | 8f7d802b7a71 |
child 62047 | 1ae53588dcbb |
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 |
|
61135
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
57686
diff
changeset
|
7 |
## settings |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
57686
diff
changeset
|
8 |
|
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
57686
diff
changeset
|
9 |
case "$ISABELLE_JAVA_PLATFORM" in |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
57686
diff
changeset
|
10 |
x86-*) |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
57686
diff
changeset
|
11 |
ISABELLE_BUILD_JAVA_OPTIONS="$ISABELLE_BUILD_JAVA_OPTIONS32" |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
57686
diff
changeset
|
12 |
;; |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
57686
diff
changeset
|
13 |
x86_64-*) |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
57686
diff
changeset
|
14 |
ISABELLE_BUILD_JAVA_OPTIONS="$ISABELLE_BUILD_JAVA_OPTIONS64" |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
57686
diff
changeset
|
15 |
;; |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
57686
diff
changeset
|
16 |
esac |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
57686
diff
changeset
|
17 |
|
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
57686
diff
changeset
|
18 |
|
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
57686
diff
changeset
|
19 |
## diagnostics |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
57686
diff
changeset
|
20 |
|
25632 | 21 |
PRG="$(basename "$0")" |
22 |
||
23 |
function usage() |
|
24 |
{ |
|
25 |
echo |
|
28650 | 26 |
echo "Usage: isabelle $PRG [OPTIONS]" |
25632 | 27 |
echo |
28 |
echo " Options are:" |
|
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
29 |
echo " -d DIR include session directory" |
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
30 |
echo " -l NAME logic session name (default ISABELLE_LOGIC=\"$ISABELLE_LOGIC\")" |
25632 | 31 |
echo " -m MODE add print mode for output" |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
32 |
echo " -n no build of session image on startup" |
52062 | 33 |
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
|
34 |
echo " -s system build mode for session image" |
25632 | 35 |
echo |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
36 |
echo " Run Isabelle process with raw ML console and line editor" |
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
37 |
echo " (ISABELLE_LINE_EDITOR=\"$ISABELLE_LINE_EDITOR\")." |
25632 | 38 |
echo |
39 |
exit 1 |
|
40 |
} |
|
41 |
||
42 |
||
43 |
## process command line |
|
44 |
||
45 |
# options |
|
46 |
||
61958 | 47 |
declare -a ISABELLE_OPTIONS=(-m ASCII) |
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
48 |
|
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
49 |
declare -a INCLUDE_DIRS=() |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
50 |
LOGIC="$ISABELLE_LOGIC" |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
51 |
NO_BUILD="false" |
57581
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
52 |
declare -a SYSTEM_OPTIONS=() |
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
53 |
SYSTEM_MODE="false" |
25632 | 54 |
|
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
55 |
while getopts "d:l:m:no:s" OPT |
25632 | 56 |
do |
57 |
case "$OPT" in |
|
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
58 |
d) |
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
59 |
INCLUDE_DIRS["${#INCLUDE_DIRS[@]}"]="$OPTARG" |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
60 |
;; |
25632 | 61 |
l) |
62 |
LOGIC="$OPTARG" |
|
63 |
;; |
|
64 |
m) |
|
52062 | 65 |
ISABELLE_OPTIONS["${#ISABELLE_OPTIONS[@]}"]="-m" |
66 |
ISABELLE_OPTIONS["${#ISABELLE_OPTIONS[@]}"]="$OPTARG" |
|
67 |
;; |
|
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
68 |
n) |
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
69 |
NO_BUILD="true" |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
70 |
;; |
52062 | 71 |
o) |
57581
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
72 |
SYSTEM_OPTIONS["${#SYSTEM_OPTIONS[@]}"]="$OPTARG" |
25632 | 73 |
;; |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
74 |
s) |
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
75 |
SYSTEM_MODE="true" |
25632 | 76 |
;; |
77 |
\?) |
|
78 |
usage |
|
79 |
;; |
|
80 |
esac |
|
81 |
done |
|
82 |
||
83 |
shift $(($OPTIND - 1)) |
|
84 |
||
85 |
||
86 |
# args |
|
87 |
||
88 |
[ "$#" -ne 0 ] && { echo "Bad args: $*"; usage; } |
|
89 |
||
90 |
||
91 |
## main |
|
92 |
||
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
93 |
isabelle_admin_build jars || exit $? |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
94 |
|
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
95 |
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
|
96 |
|
57686 | 97 |
mkdir -p "$ISABELLE_TMP_PREFIX" || exit $? |
57581
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
98 |
OPTIONS_FILE="$ISABELLE_TMP_PREFIX/options$$" |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
99 |
|
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57439
diff
changeset
|
100 |
"$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" isabelle.Build_Console \ |
57581
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
101 |
"$LOGIC" "$NO_BUILD" "$SYSTEM_MODE" "$OPTIONS_FILE" \ |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
102 |
"${INCLUDE_DIRS[@]}" $'\n' "${SYSTEM_OPTIONS[@]}" || { |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
103 |
rm -f "$OPTIONS_FILE" |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
104 |
exit "$?" |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
105 |
} |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
106 |
|
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
107 |
ISABELLE_OPTIONS["${#ISABELLE_OPTIONS[@]}"]="-O" |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
108 |
ISABELLE_OPTIONS["${#ISABELLE_OPTIONS[@]}"]="$OPTIONS_FILE" |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
109 |
|
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
110 |
if type -p "$ISABELLE_LINE_EDITOR" > /dev/null |
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
111 |
then |
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
112 |
exec "$ISABELLE_LINE_EDITOR" "$ISABELLE_PROCESS" "${ISABELLE_OPTIONS[@]}" -- "$LOGIC" |
25632 | 113 |
else |
57439
0e41f26a0250
"isabelle tty" is superseded by "isabelle console";
wenzelm
parents:
52062
diff
changeset
|
114 |
echo "### No line editor: \"$ISABELLE_LINE_EDITOR\"" |
52062 | 115 |
exec "$ISABELLE_PROCESS" "${ISABELLE_OPTIONS[@]}" -- "$LOGIC" |
25632 | 116 |
fi |