author | wenzelm |
Sat, 19 Jan 2013 12:53:13 +0100 | |
changeset 50984 | 7c07ade3c8e0 |
parent 50805 | 69439c9defec |
child 53498 | 05313b45a5ae |
permissions | -rw-r--r-- |
29136 | 1 |
#!/bin/bash |
2 |
# |
|
3 |
# Author: Makarius |
|
4 |
# |
|
5 |
# Isabelle application wrapper |
|
6 |
||
7 |
THIS="$(cd "$(dirname "$0")"; pwd)" |
|
29149
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
8 |
THIS_APP="$(cd "$THIS/../.."; pwd)" |
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
9 |
SUPER_APP="$(cd "$THIS/../../.."; pwd)" |
29136 | 10 |
|
29173
c14c9a41f1ac
PATH: /opt/local/bin is back again (required for latex etc.);
wenzelm
parents:
29149
diff
changeset
|
11 |
|
50792
b7e38c13d87b
eliminated choosefrom -- power-users may edit global defaults within script;
wenzelm
parents:
48695
diff
changeset
|
12 |
# global defaults |
b7e38c13d87b
eliminated choosefrom -- power-users may edit global defaults within script;
wenzelm
parents:
48695
diff
changeset
|
13 |
|
b7e38c13d87b
eliminated choosefrom -- power-users may edit global defaults within script;
wenzelm
parents:
48695
diff
changeset
|
14 |
ISABELLE_TOOL="$THIS/Isabelle/bin/isabelle" |
b7e38c13d87b
eliminated choosefrom -- power-users may edit global defaults within script;
wenzelm
parents:
48695
diff
changeset
|
15 |
PROOFGENERAL_EMACS="$THIS/Aquamacs.app/Contents/MacOS/Aquamacs" |
b7e38c13d87b
eliminated choosefrom -- power-users may edit global defaults within script;
wenzelm
parents:
48695
diff
changeset
|
16 |
|
b7e38c13d87b
eliminated choosefrom -- power-users may edit global defaults within script;
wenzelm
parents:
48695
diff
changeset
|
17 |
|
b7e38c13d87b
eliminated choosefrom -- power-users may edit global defaults within script;
wenzelm
parents:
48695
diff
changeset
|
18 |
# environment |
41643
10b0d338d99e
default UTF-8 locale, to work with funny base directory (e.g. Chinese);
wenzelm
parents:
41642
diff
changeset
|
19 |
|
29136 | 20 |
cd "$HOME" |
44985
272e8e4e4fc7
imitate Apple in setting initial shell PATH -- especially relevant for MacTeX, MacPorts etc.;
wenzelm
parents:
44948
diff
changeset
|
21 |
if [ -x /usr/libexec/path_helper ]; then |
272e8e4e4fc7
imitate Apple in setting initial shell PATH -- especially relevant for MacTeX, MacPorts etc.;
wenzelm
parents:
44948
diff
changeset
|
22 |
eval $(/usr/libexec/path_helper -s) |
272e8e4e4fc7
imitate Apple in setting initial shell PATH -- especially relevant for MacTeX, MacPorts etc.;
wenzelm
parents:
44948
diff
changeset
|
23 |
fi |
29136 | 24 |
|
41643
10b0d338d99e
default UTF-8 locale, to work with funny base directory (e.g. Chinese);
wenzelm
parents:
41642
diff
changeset
|
25 |
[ -z "$LANG" ] && export LANG=en_US.UTF-8 |
10b0d338d99e
default UTF-8 locale, to work with funny base directory (e.g. Chinese);
wenzelm
parents:
41642
diff
changeset
|
26 |
|
29136 | 27 |
|
29149
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
28 |
# run interface with error feedback |
29136 | 29 |
|
44881 | 30 |
ISABELLE_INTERFACE_CHOICE="$("$ISABELLE_TOOL" getenv -b ISABELLE_INTERFACE_CHOICE)" |
31 |
if [ "$ISABELLE_INTERFACE_CHOICE" != emacs -a "$ISABELLE_INTERFACE_CHOICE" != jedit ] |
|
32 |
then |
|
33 |
declare -a CHOICE |
|
34 |
CHOICE=($("$THIS/CocoaDialog.app/Contents/MacOS/CocoaDialog" dropdown \ |
|
35 |
--title Isabelle \ |
|
36 |
--text "Which Isabelle interface?" \ |
|
50792
b7e38c13d87b
eliminated choosefrom -- power-users may edit global defaults within script;
wenzelm
parents:
48695
diff
changeset
|
37 |
--items "Isabelle/jEdit PIDE" "Emacs / Proof General" \ |
44881 | 38 |
--button2 "OK, do not ask again" --button1 "OK")) |
39 |
if [ "${CHOICE[1]}" = 0 ]; then |
|
50792
b7e38c13d87b
eliminated choosefrom -- power-users may edit global defaults within script;
wenzelm
parents:
48695
diff
changeset
|
40 |
ISABELLE_INTERFACE_CHOICE=jedit |
44881 | 41 |
else |
50792
b7e38c13d87b
eliminated choosefrom -- power-users may edit global defaults within script;
wenzelm
parents:
48695
diff
changeset
|
42 |
ISABELLE_INTERFACE_CHOICE=emacs |
44881 | 43 |
fi |
44 |
if [ "${CHOICE[0]}" = 2 ]; then |
|
45 |
ISABELLE_HOME_USER="$("$ISABELLE_TOOL" getenv -b ISABELLE_HOME_USER)" |
|
46 |
mkdir -p "$ISABELLE_HOME_USER/etc" |
|
47 |
( echo; echo "ISABELLE_INTERFACE_CHOICE=$ISABELLE_INTERFACE_CHOICE"; ) \ |
|
48 |
>> "$ISABELLE_HOME_USER/etc/settings" |
|
49 |
"$THIS/CocoaDialog.app/Contents/MacOS/CocoaDialog" ok-msgbox \ |
|
50 |
--title Isabelle \ |
|
51 |
--text Note \ |
|
52 |
--informative-text "ISABELLE_INTERFACE_CHOICE stored in $ISABELLE_HOME_USER/etc/settings" \ |
|
53 |
--no-cancel |
|
54 |
fi |
|
55 |
fi |
|
56 |
||
29136 | 57 |
OUTPUT="/tmp/isabelle$$.out" |
58 |
||
44881 | 59 |
if [ "$ISABELLE_INTERFACE_CHOICE" = emacs ]; then |
50792
b7e38c13d87b
eliminated choosefrom -- power-users may edit global defaults within script;
wenzelm
parents:
48695
diff
changeset
|
60 |
( "$ISABELLE_TOOL" emacs -p "$PROOFGENERAL_EMACS" "$@" ) > "$OUTPUT" 2>&1 |
44880 | 61 |
RC=$? |
62 |
else |
|
50805
69439c9defec
prefer system build mode in main application wrappers, to produce heaps insided distribution directory;
wenzelm
parents:
50792
diff
changeset
|
63 |
( "$ISABELLE_TOOL" jedit -s "$@" ) > "$OUTPUT" 2>&1 |
44880 | 64 |
RC=$? |
65 |
fi |
|
29136 | 66 |
|
67 |
if [ "$RC" != 0 ]; then |
|
68 |
echo >> "$OUTPUT" |
|
69 |
echo "Return code: $RC" >> "$OUTPUT" |
|
70 |
fi |
|
71 |
||
29149
eae45c2a6811
more sophisticated MacOS interface script (mostly for Carbon Emacs);
wenzelm
parents:
29136
diff
changeset
|
72 |
if [ $(stat -f "%z" "$OUTPUT") != 0 ]; then |
29136 | 73 |
"$THIS/CocoaDialog.app/Contents/MacOS/CocoaDialog" textbox \ |
74 |
--title "Isabelle" \ |
|
75 |
--informative-text "Isabelle output" \ |
|
76 |
--text-from-file "$OUTPUT" \ |
|
77 |
--button1 "OK" |
|
78 |
fi |
|
79 |
||
80 |
rm -f "$OUTPUT" |
|
81 |
||
82 |
exit "$RC" |