lib/Tools/codegen
author wenzelm
Thu, 15 May 2008 20:02:42 +0200
changeset 26911 871cc7f11034
parent 25611 c0deb7307732
child 27103 d8549f4d900b
permissions -rwxr-xr-x
use Isabelle sty files from Doc/;

#!/usr/bin/env bash
#
# $Id$
# Author: Florian Haftmann, TUM
#
# DESCRIPTION: issue code generation from shell


## diagnostics

PRG="$(basename "$0")"

function usage()
{
  echo
  echo "Usage: $PRG IMAGE THY CMD"
  echo
  echo "  Issues code generation using image IMAGE,"
  echo "  theory THY,"
  echo "  with Isar command 'export_code CMD'"
  echo
  exit 1
}


## process command line

[ "$#" -lt 2 -o "$1" = "-?" ] && usage

IMAGE="$1"; shift
THY="$1"; shift
CMD="$1"


## main

CMD=$(echo $CMD | sed -e 's/\\/\\\\"/g; s/"/\\\"/g')
FULL_CMD="CodePackage.codegen_shell_command \"$THY\" \"$CMD\";"

"$ISABELLE" -q -e "$FULL_CMD" "$IMAGE" || exit 1