21884
|
1 |
#!/usr/bin/env bash
|
|
2 |
#
|
|
3 |
# $Id$
|
|
4 |
# Author: Florian Haftmann, TUM
|
|
5 |
#
|
|
6 |
# DESCRIPTION: issue code generation from shell
|
|
7 |
|
|
8 |
|
|
9 |
## diagnostics
|
|
10 |
|
|
11 |
PRG="$(basename "$0")"
|
|
12 |
|
|
13 |
function usage()
|
|
14 |
{
|
|
15 |
echo
|
|
16 |
echo "Usage: $PRG IMAGE THY SERI"
|
|
17 |
echo
|
|
18 |
echo " Issues code generation using image IMAGE,"
|
|
19 |
echo " theory THY,"
|
|
20 |
echo " with Isar command 'code_gen SERI'"
|
|
21 |
echo
|
|
22 |
exit 1
|
|
23 |
}
|
|
24 |
|
|
25 |
|
|
26 |
## process command line
|
|
27 |
|
|
28 |
[ "$#" -lt 2 -o "$1" = "-?" ] && usage
|
|
29 |
|
|
30 |
IMAGE="$1"; shift
|
|
31 |
THY="$1"; shift
|
|
32 |
SERI="$1"
|
|
33 |
|
|
34 |
|
|
35 |
## main
|
|
36 |
|
|
37 |
SERI=$(echo $SERI | sed -e 's/\\/\\\\"/g; s/"/\\\"/g')
|
|
38 |
CMD="Isar.toplevel (fn _ => (use_thy \"$THY\"; CodegenPackage.codegen_command (theory \"$THY\") \"$SERI\"))"
|
|
39 |
|
|
40 |
"$ISABELLE" -q -e "$CMD" "$IMAGE"
|