7 THIS="$(cd "$(dirname "$0")"; pwd)" |
7 THIS="$(cd "$(dirname "$0")"; pwd)" |
8 THIS_APP="$(cd "$THIS/../.."; pwd)" |
8 THIS_APP="$(cd "$THIS/../.."; pwd)" |
9 SUPER_APP="$(cd "$THIS/../../.."; pwd)" |
9 SUPER_APP="$(cd "$THIS/../../.."; pwd)" |
10 |
10 |
11 |
11 |
12 # sane environment defaults |
12 # global defaults |
|
13 |
|
14 ISABELLE_TOOL="$THIS/Isabelle/bin/isabelle" |
|
15 PROOFGENERAL_EMACS="$THIS/Aquamacs.app/Contents/MacOS/Aquamacs" |
|
16 |
|
17 |
|
18 # environment |
13 |
19 |
14 cd "$HOME" |
20 cd "$HOME" |
15 if [ -x /usr/libexec/path_helper ]; then |
21 if [ -x /usr/libexec/path_helper ]; then |
16 eval $(/usr/libexec/path_helper -s) |
22 eval $(/usr/libexec/path_helper -s) |
17 fi |
23 fi |
18 |
24 |
19 [ -z "$LANG" ] && export LANG=en_US.UTF-8 |
25 [ -z "$LANG" ] && export LANG=en_US.UTF-8 |
20 |
|
21 |
|
22 # settings support |
|
23 |
|
24 function choosefrom () |
|
25 { |
|
26 local RESULT="" |
|
27 local FILE="" |
|
28 |
|
29 for FILE in "$@" |
|
30 do |
|
31 [ -z "$RESULT" -a -e "$FILE" ] && RESULT="$FILE" |
|
32 done |
|
33 |
|
34 [ -z "$RESULT" ] && RESULT="$FILE" |
|
35 echo "$RESULT" |
|
36 } |
|
37 |
|
38 |
|
39 # Isabelle |
|
40 |
|
41 ISABELLE_TOOL="$(choosefrom \ |
|
42 "$THIS/Isabelle/bin/isabelle" \ |
|
43 "$SUPER_APP/Isabelle/bin/isabelle" \ |
|
44 "$HOME/bin/isabelle" \ |
|
45 isabelle)" |
|
46 |
|
47 |
|
48 # Proof General / Emacs |
|
49 |
|
50 PROOFGENERAL_EMACS="$(choosefrom \ |
|
51 "$THIS/Aquamacs.app/Contents/MacOS/Aquamacs" \ |
|
52 "$SUPER_APP/Aquamacs.app/Contents/MacOS/Aquamacs" \ |
|
53 /Applications/Aquamacs.app/Contents/MacOS/Aquamacs \ |
|
54 "")" |
|
55 |
|
56 declare -a EMACS_OPTIONS=() |
|
57 if [ -n "$PROOFGENERAL_EMACS" ]; then |
|
58 EMACS_OPTIONS=(-p "$PROOFGENERAL_EMACS") |
|
59 fi |
|
60 |
26 |
61 |
27 |
62 # run interface with error feedback |
28 # run interface with error feedback |
63 |
29 |
64 ISABELLE_INTERFACE_CHOICE="$("$ISABELLE_TOOL" getenv -b ISABELLE_INTERFACE_CHOICE)" |
30 ISABELLE_INTERFACE_CHOICE="$("$ISABELLE_TOOL" getenv -b ISABELLE_INTERFACE_CHOICE)" |
66 then |
32 then |
67 declare -a CHOICE |
33 declare -a CHOICE |
68 CHOICE=($("$THIS/CocoaDialog.app/Contents/MacOS/CocoaDialog" dropdown \ |
34 CHOICE=($("$THIS/CocoaDialog.app/Contents/MacOS/CocoaDialog" dropdown \ |
69 --title Isabelle \ |
35 --title Isabelle \ |
70 --text "Which Isabelle interface?" \ |
36 --text "Which Isabelle interface?" \ |
71 --items "Emacs / Proof General" "Isabelle/jEdit PIDE" \ |
37 --items "Isabelle/jEdit PIDE" "Emacs / Proof General" \ |
72 --button2 "OK, do not ask again" --button1 "OK")) |
38 --button2 "OK, do not ask again" --button1 "OK")) |
73 if [ "${CHOICE[1]}" = 0 ]; then |
39 if [ "${CHOICE[1]}" = 0 ]; then |
|
40 ISABELLE_INTERFACE_CHOICE=jedit |
|
41 else |
74 ISABELLE_INTERFACE_CHOICE=emacs |
42 ISABELLE_INTERFACE_CHOICE=emacs |
75 else |
|
76 ISABELLE_INTERFACE_CHOICE=jedit |
|
77 fi |
43 fi |
78 if [ "${CHOICE[0]}" = 2 ]; then |
44 if [ "${CHOICE[0]}" = 2 ]; then |
79 ISABELLE_HOME_USER="$("$ISABELLE_TOOL" getenv -b ISABELLE_HOME_USER)" |
45 ISABELLE_HOME_USER="$("$ISABELLE_TOOL" getenv -b ISABELLE_HOME_USER)" |
80 mkdir -p "$ISABELLE_HOME_USER/etc" |
46 mkdir -p "$ISABELLE_HOME_USER/etc" |
81 ( echo; echo "ISABELLE_INTERFACE_CHOICE=$ISABELLE_INTERFACE_CHOICE"; ) \ |
47 ( echo; echo "ISABELLE_INTERFACE_CHOICE=$ISABELLE_INTERFACE_CHOICE"; ) \ |