author | wenzelm |
Thu, 08 Jul 1999 18:40:43 +0200 | |
changeset 6940 | ee6640456cbb |
parent 6652 | 401f14f25648 |
child 7226 | 1a4ed2eb48f3 |
permissions | -rwxr-xr-x |
3007 | 1 |
#!/bin/bash |
2808 | 2 |
# |
3 |
# $Id$ |
|
4 |
# |
|
5 |
# DESCRIPTION: build object-logic or run examples |
|
6 |
||
7 |
||
8 |
## diagnostics |
|
9 |
||
10 |
PRG=$(basename $0) |
|
11 |
||
12 |
function usage() |
|
13 |
{ |
|
14 |
echo |
|
15 |
echo "Usage: $PRG LOGIC NAME" |
|
16 |
echo |
|
17 |
echo " Options are:" |
|
6940 | 18 |
echo " -B build mode with THIS_IS_ISABELLE_BUILD indication" |
19 |
echo " -P PATH set path for remote theory browsing information" |
|
6212 | 20 |
echo " -b build mode (output heap image, using current dir)" |
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
21 |
echo " -i BOOL generate theory browsing information," |
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
22 |
echo " i.e. HTML / graph data (default false)" |
6212 | 23 |
echo " -r reset session path" |
2808 | 24 |
echo " -s NAME override session NAME" |
25 |
echo |
|
26 |
echo " Build object-logic or run examples. Also creates browsing" |
|
27 |
echo " information (HTML etc.) according to settings." |
|
28 |
echo |
|
29 |
exit 1 |
|
30 |
} |
|
31 |
||
32 |
||
33 |
## process command line |
|
34 |
||
35 |
# options |
|
36 |
||
37 |
BUILD="" |
|
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
38 |
INFO=false |
6212 | 39 |
RESET=false |
2808 | 40 |
SESSION="" |
6652
401f14f25648
usedir now recognizes additional option -P which is used to
berghofe
parents:
6249
diff
changeset
|
41 |
RPATH="" |
2808 | 42 |
|
2917 | 43 |
function getoptions() |
44 |
{ |
|
45 |
OPTIND=1 |
|
6940 | 46 |
while getopts "BP:bi:rs:" OPT |
2917 | 47 |
do |
48 |
case "$OPT" in |
|
6940 | 49 |
B) |
50 |
BUILD=true |
|
51 |
export THIS_IS_ISABELLE_BUILD=true |
|
52 |
;; |
|
2917 | 53 |
b) |
54 |
BUILD=true |
|
55 |
;; |
|
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
56 |
i) |
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
57 |
INFO="$OPTARG" |
2917 | 58 |
;; |
6212 | 59 |
r) |
60 |
RESET=true |
|
61 |
;; |
|
2917 | 62 |
s) |
63 |
SESSION="$OPTARG" |
|
64 |
;; |
|
6652
401f14f25648
usedir now recognizes additional option -P which is used to
berghofe
parents:
6249
diff
changeset
|
65 |
P) |
401f14f25648
usedir now recognizes additional option -P which is used to
berghofe
parents:
6249
diff
changeset
|
66 |
RPATH="$OPTARG" |
401f14f25648
usedir now recognizes additional option -P which is used to
berghofe
parents:
6249
diff
changeset
|
67 |
;; |
2917 | 68 |
\?) |
69 |
usage |
|
70 |
;; |
|
71 |
esac |
|
72 |
done |
|
73 |
} |
|
2808 | 74 |
|
2917 | 75 |
getoptions $ISABELLE_USEDIR_OPTIONS |
76 |
||
77 |
getoptions "$@" |
|
2808 | 78 |
shift $(($OPTIND - 1)) |
79 |
||
80 |
||
81 |
# args |
|
82 |
||
83 |
[ $# -ne 2 ] && usage |
|
84 |
||
85 |
LOGIC="$1"; shift |
|
86 |
NAME="$1"; shift |
|
87 |
||
4419 | 88 |
[ -z "$SESSION" ] && SESSION=$(basename $NAME) |
2808 | 89 |
|
4419 | 90 |
|
91 |
||
92 |
## main |
|
3636
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
93 |
|
4451 | 94 |
# prepare browser info dir |
4419 | 95 |
|
4586 | 96 |
if [ "$INFO" = "true" -a ! -f $ISABELLE_BROWSER_INFO/index.html ]; then |
4419 | 97 |
|
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
98 |
mkdir -p $ISABELLE_BROWSER_INFO/gif |
3848 | 99 |
cp $ISABELLE_HOME/lib/logo/isabelle.gif $ISABELLE_BROWSER_INFO/gif/isabelle.gif |
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
100 |
cp $ISABELLE_HOME/lib/html/index1.html $ISABELLE_BROWSER_INFO/index.html |
4419 | 101 |
|
3636
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
102 |
mkdir -p $ISABELLE_BROWSER_INFO/graph |
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
103 |
cp $ISABELLE_HOME/lib/html/index2.html $ISABELLE_BROWSER_INFO/graph/index.html |
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
104 |
mkdir $ISABELLE_BROWSER_INFO/graph/GraphBrowser |
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
105 |
mkdir $ISABELLE_BROWSER_INFO/graph/awtUtilities |
4419 | 106 |
cp $ISABELLE_HOME/lib/browser/GraphBrowser/*.class $ISABELLE_BROWSER_INFO/graph/GraphBrowser |
107 |
cp $ISABELLE_HOME/lib/browser/awtUtilities/*.class $ISABELLE_BROWSER_INFO/graph/awtUtilities |
|
108 |
||
3636
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
109 |
fi |
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
110 |
|
2808 | 111 |
|
4451 | 112 |
# prepare log dir |
113 |
||
114 |
LOGDIR="$ISABELLE_OUTPUT/log" |
|
115 |
mkdir -p "$LOGDIR" |
|
116 |
||
117 |
||
118 |
# run isabelle |
|
119 |
||
120 |
SECONDS=0 |
|
121 |
||
6249 | 122 |
PARENT=$(basename "$LOGIC") |
123 |
||
2808 | 124 |
if [ -n "$BUILD" ]; then |
4451 | 125 |
ITEM="$SESSION" |
126 |
echo -n "Building $ITEM ... " |
|
127 |
LOG="$LOGDIR/$ITEM" |
|
128 |
||
129 |
$ISABELLE \ |
|
6652
401f14f25648
usedir now recognizes additional option -P which is used to
berghofe
parents:
6249
diff
changeset
|
130 |
-e "Session.use_dir $RESET $INFO \"$PARENT\" \"$SESSION\" \"$RPATH\";" \ |
4492 | 131 |
-q -w $LOGIC $NAME > $LOG 2>&1 |
6249 | 132 |
RC=$? |
2808 | 133 |
else |
4451 | 134 |
ITEM=$(basename $LOGIC)-"$SESSION" |
135 |
echo -n "Running $ITEM ... " |
|
136 |
LOG="$LOGDIR/$ITEM" |
|
137 |
||
6212 | 138 |
cd "$NAME" |
4451 | 139 |
$ISABELLE \ |
6652
401f14f25648
usedir now recognizes additional option -P which is used to
berghofe
parents:
6249
diff
changeset
|
140 |
-e "Session.use_dir $RESET $INFO \"$PARENT\" \"$SESSION\" \"$RPATH\"; quit();" \ |
4492 | 141 |
-r -q $LOGIC > $LOG 2>&1 |
6249 | 142 |
RC=$? |
6212 | 143 |
cd .. |
2808 | 144 |
fi |
4451 | 145 |
|
146 |
ELAPSED=$($ISABELLE_HOME/lib/scripts/showtime $SECONDS) |
|
147 |
||
148 |
||
149 |
# exit status |
|
150 |
||
151 |
if [ $RC -eq 0 ]; then |
|
152 |
echo "OK ($ELAPSED elapsed time)" |
|
153 |
gzip --force "$LOG" |
|
154 |
else |
|
155 |
echo "FAILED" |
|
156 |
echo "(see also $LOG)" |
|
157 |
echo; tail $LOG; echo |
|
158 |
fi |
|
159 |
||
160 |
exit $RC |