author | wenzelm |
Thu, 30 Nov 2000 20:10:29 +0100 | |
changeset 10555 | 2323ec838401 |
parent 10511 | efb3428c9879 |
child 10562 | fcd29e58c40c |
permissions | -rwxr-xr-x |
10555 | 1 |
#!/usr/bin/env bash |
2808 | 2 |
# |
3 |
# $Id$ |
|
9788 | 4 |
# Author: Markus Wenzel, TU Muenchen |
5 |
# License: GPL (GNU GENERAL PUBLIC LICENSE) |
|
2808 | 6 |
# |
7 |
# DESCRIPTION: build object-logic or run examples |
|
8 |
||
9 |
||
10 |
## diagnostics |
|
11 |
||
10511 | 12 |
PRG="$(basename "$0")" |
2808 | 13 |
|
14 |
function usage() |
|
15 |
{ |
|
16 |
echo |
|
9237 | 17 |
echo "Usage: $PRG [OPTIONS] LOGIC NAME" |
2808 | 18 |
echo |
19 |
echo " Options are:" |
|
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
20 |
echo " -D PATH dump generated document sources into PATH" |
6940 | 21 |
echo " -P PATH set path for remote theory browsing information" |
6212 | 22 |
echo " -b build mode (output heap image, using current dir)" |
8359
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
23 |
echo " -c BOOL tell ML system to compress output image (default true)" |
7737 | 24 |
echo " -d FORMAT build document as FORMAT (default false)" |
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
25 |
echo " -i BOOL generate theory browsing information," |
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
26 |
echo " i.e. HTML / graph data (default false)" |
6212 | 27 |
echo " -r reset session path" |
2808 | 28 |
echo " -s NAME override session NAME" |
29 |
echo |
|
30 |
echo " Build object-logic or run examples. Also creates browsing" |
|
31 |
echo " information (HTML etc.) according to settings." |
|
32 |
echo |
|
7461 | 33 |
echo " ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS" |
34 |
echo |
|
2808 | 35 |
exit 1 |
36 |
} |
|
37 |
||
38 |
||
39 |
## process command line |
|
40 |
||
41 |
# options |
|
42 |
||
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
43 |
DUMP="" |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
44 |
RPATH="" |
2808 | 45 |
BUILD="" |
8747 | 46 |
COMPRESS=true |
7737 | 47 |
DOCUMENT=false |
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
48 |
INFO=false |
6212 | 49 |
RESET=false |
2808 | 50 |
SESSION="" |
51 |
||
2917 | 52 |
function getoptions() |
53 |
{ |
|
54 |
OPTIND=1 |
|
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
55 |
while getopts "D:P:bc:d:i:rs:" OPT |
2917 | 56 |
do |
57 |
case "$OPT" in |
|
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
58 |
D) |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
59 |
DUMP="$OPTARG" |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
60 |
;; |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
61 |
P) |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
62 |
RPATH="$OPTARG" |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
63 |
;; |
2917 | 64 |
b) |
65 |
BUILD=true |
|
66 |
;; |
|
8359
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
67 |
c) |
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
68 |
COMPRESS="$OPTARG" |
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
69 |
;; |
7737 | 70 |
d) |
71 |
DOCUMENT="$OPTARG" |
|
72 |
;; |
|
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
73 |
i) |
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
74 |
INFO="$OPTARG" |
2917 | 75 |
;; |
6212 | 76 |
r) |
77 |
RESET=true |
|
78 |
;; |
|
2917 | 79 |
s) |
80 |
SESSION="$OPTARG" |
|
81 |
;; |
|
82 |
\?) |
|
83 |
usage |
|
84 |
;; |
|
85 |
esac |
|
86 |
done |
|
87 |
} |
|
2808 | 88 |
|
2917 | 89 |
getoptions $ISABELLE_USEDIR_OPTIONS |
90 |
||
91 |
getoptions "$@" |
|
2808 | 92 |
shift $(($OPTIND - 1)) |
93 |
||
94 |
||
95 |
# args |
|
96 |
||
9788 | 97 |
[ "$#" -ne 2 ] && usage |
2808 | 98 |
|
99 |
LOGIC="$1"; shift |
|
100 |
NAME="$1"; shift |
|
101 |
||
9788 | 102 |
[ -z "$SESSION" ] && SESSION=$(basename "$NAME") |
2808 | 103 |
|
4419 | 104 |
|
105 |
||
106 |
## main |
|
3636
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
107 |
|
4451 | 108 |
# prepare browser info dir |
4419 | 109 |
|
9788 | 110 |
if [ "$INFO" = "true" -a ! -f "$ISABELLE_BROWSER_INFO/index.html" ]; then |
111 |
mkdir -p "$ISABELLE_BROWSER_INFO" |
|
112 |
cp "$ISABELLE_HOME/lib/logo/isabelle.gif" "$ISABELLE_BROWSER_INFO/isabelle.gif" |
|
113 |
cp "$ISABELLE_HOME/lib/html/index.html" "$ISABELLE_BROWSER_INFO/index.html" |
|
3636
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
114 |
fi |
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
115 |
|
2808 | 116 |
|
4451 | 117 |
# prepare log dir |
118 |
||
119 |
LOGDIR="$ISABELLE_OUTPUT/log" |
|
120 |
mkdir -p "$LOGDIR" |
|
121 |
||
122 |
||
123 |
# run isabelle |
|
124 |
||
7737 | 125 |
PARENT=$(basename "$LOGIC") |
126 |
||
127 |
[ -z "$BUILD" ] && cd "$NAME" |
|
4451 | 128 |
|
8568 | 129 |
if [ "$DOCUMENT" != false -a -d document ]; then |
130 |
DOC="$DOCUMENT" |
|
9788 | 131 |
[ -n "$DUMP" -a -d "$DUMP" ] && "$ISATOOL" latex -o sty "$DUMP/root.tex" >/dev/null |
8568 | 132 |
else |
133 |
DOC="" |
|
134 |
fi |
|
7737 | 135 |
|
136 |
||
137 |
SECONDS=0 |
|
6249 | 138 |
|
2808 | 139 |
if [ -n "$BUILD" ]; then |
4451 | 140 |
ITEM="$SESSION" |
7275 | 141 |
echo "Building $ITEM ..." |
4451 | 142 |
LOG="$LOGDIR/$ITEM" |
143 |
||
8359
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
144 |
OPT_C="" |
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
145 |
[ "$COMPRESS" = true ] && OPT_C="-c" |
124ad46105dd
option -c: tell ML system to compress output image;
wenzelm
parents:
8241
diff
changeset
|
146 |
|
9788 | 147 |
"$ISABELLE" \ |
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
148 |
-e "Session.use_dir $RESET $INFO \"$DOC\" \"$PARENT\" \"$SESSION\" \"$DUMP\" \"$RPATH\";" \ |
9788 | 149 |
$OPT_C -q -w $LOGIC $NAME > "$LOG" 2>&1 |
150 |
RC="$?" |
|
2808 | 151 |
else |
9788 | 152 |
ITEM=$(basename "$LOGIC")-"$SESSION" |
7275 | 153 |
echo "Running $ITEM ..." |
4451 | 154 |
LOG="$LOGDIR/$ITEM" |
155 |
||
9788 | 156 |
"$ISABELLE" \ |
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
157 |
-e "Session.use_dir $RESET $INFO \"$DOC\" \"$PARENT\" \"$SESSION\" \"$DUMP\" \"$RPATH\"; quit();" \ |
9788 | 158 |
-r -q "$LOGIC" > "$LOG" 2>&1 |
159 |
RC="$?" |
|
6212 | 160 |
cd .. |
2808 | 161 |
fi |
4451 | 162 |
|
9788 | 163 |
ELAPSED=$("$ISABELLE_HOME/lib/scripts/showtime" "$SECONDS") |
4451 | 164 |
|
165 |
||
166 |
# exit status |
|
167 |
||
9788 | 168 |
if [ "$RC" -eq 0 ]; then |
7275 | 169 |
echo "Finished $ITEM ($ELAPSED elapsed time)" |
4451 | 170 |
gzip --force "$LOG" |
171 |
else |
|
7259 | 172 |
echo "$ITEM FAILED" |
4451 | 173 |
echo "(see also $LOG)" |
9788 | 174 |
echo; tail "$LOG"; echo |
4451 | 175 |
fi |
176 |
||
9788 | 177 |
exit "$RC" |