lib/Tools/usedir
author paulson
Thu, 05 Jun 1997 13:22:25 +0200
changeset 3403 6cc663f6d62e
parent 3264 4ca0b6507ed5
child 3504 8493dbe2f009
permissions -rwxr-xr-x
A slight simplification of optstring The new "simpset" keyword in the "recdef" declaration

#!/bin/bash
#
# $Id$
#
# DESCRIPTION: build object-logic or run examples


## diagnostics

PRG=$(basename $0)

function usage()
{
  echo
  echo "Usage: $PRG LOGIC NAME"
  echo
  echo "  Options are:"
  echo "    -b           build mode (output heap image, use dir \".\")"
  echo "    -g BOOL      generate theory graph data (default false)"
  echo "    -h BOOL      generate theory HTML data (default false)"
  echo "    -s NAME      override session NAME"
  echo
  echo "  Build object-logic or run examples. Also creates browsing"
  echo "  information (HTML etc.) according to settings."
  echo
  exit 1
}


## process command line

# options

BUILD=""
GRAPH=false
HTML=false
SESSION=""

function getoptions()
{
  OPTIND=1
  while getopts "bcg:h:s:" OPT
  do
    case "$OPT" in
      b)
        BUILD=true
        ;;
      g)
        GRAPH="$OPTARG"
        ;;
      h)
        HTML="$OPTARG"
        ;;
      s)
        SESSION="$OPTARG"
        ;;
      \?)
        usage
        ;;
    esac
  done
}

getoptions $ISABELLE_USEDIR_OPTIONS

getoptions "$@"
shift $(($OPTIND - 1))


# args

[ $# -ne 2 ] && usage

LOGIC="$1"; shift
NAME="$1"; shift



## main

[ -z "$SESSION" ] && SESSION=$(basename $NAME)

if [ -n "$BUILD" ]; then
  exec $ISABELLE \
    -e "make_html := $HTML; set_session\"$SESSION\"; exit_use_dir\".\"; make_html := false;" \
    -q $LOGIC $NAME
else
  exec $ISABELLE \
    -e "make_html := $HTML; set_session\"$SESSION\"; exit_use_dir\"$NAME\"; make_html := false; quit();" \
    -r -q $LOGIC
fi