lib/scripts/isa-xterm
author wenzelm
Tue, 28 Mar 2000 11:50:23 +0200
changeset 8598 f625793c4fff
parent 7459 173efad74891
child 9789 7e5e6c47c0b5
permissions -rwxr-xr-x
-I option;

#!/bin/bash
#
# $Id$
#
# Simple Isabelle interface based on xterm.


## diagnostics

PRG=$(basename $0)

function usage()
{
  echo
  echo "Usage: $PRG [OPTIONS] [--] [CMDLINE]"
  echo
  echo "  Options are:"
  echo "    -I           startup Isar interaction mode"
  echo "    -g GEOM      main window geometry (default 80x60)"
  echo "    -h MODE      highlight mode, may be false, bold (default), color"
  echo "    -m MODE      pass print mode"
  echo "    -p TEXT      pass text (options etc.) to isabelle session"
  echo "    -s BOOL      symbolic font output? (default true)"
  echo "    -x PRG       executable program (default xterm)"
  echo
  echo "  Starts Isabelle within an xterm window. CMDLINE is passed"
  echo "  directly to the isabelle session."
  echo
  echo "  ISABELLE_XTERM_OPTIONS=$ISABELLE_XTERM_OPTIONS"
  echo
  exit 1
}

function fail()
{
  echo "$1" >&2
  exit 2
}


## process command line

# options

MAINGEOM="80x60"
HILITE=bold
PASS=""
PASS_MODE=""
SYMBOLS="true"
XTERM="xterm"

function getoptions()
{
  OPTIND=1
  while getopts "Ig:h:m:p:s:x:" OPT
  do
    case "$OPT" in
      I)
        PASS="$PASS -I"
        ;;
      g)
        MAINGEOM="$OPTARG"
        ;;
      h)
        HILITE="$OPTARG"
        ;;
      m)
        PASS_MODE="$PASS_MODE -m$OPTARG"
        ;;
      p)
        PASS="$PASS $OPTARG"
        ;;
      s)
        SYMBOLS="$OPTARG"
        ;;
      x)
        XTERM="$OPTARG"
        ;;
      \?)
        usage
        ;;
    esac
  done
}

getoptions $ISABELLE_XTERM_OPTIONS

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


## main

if [ "$HILITE" = bold ]; then
  PASS="-mxterm $PASS"
elif [ "$HILITE" = color ]; then
  PASS="-mxterm_color $PASS"
elif [ -n "$HILITE" -a "$HILITE" != false ]; then
  echo "WARNING: unknown highlight mode '$HILITE'" >&2
fi

PASS="$PASS_MODE $PASS"

if [ -z "$SYMBOLS" -o "$SYMBOLS" = false ]; then
  exec $XTERM -T Isabelle -n Isabelle -geometry "$MAINGEOM" -e $ISABELLE $PASS "$@"
else
  $ISATOOL installfonts
  exec $XTERM -T Isabelle -n Isabelle -geometry "$MAINGEOM" -fn isabelle14 \
    -xrm "*fontMenu.Label: Isabelle fonts" \
    -xrm "*fontMenu*font1*Label: Large" \
    -xrm "*VT100*font1: isabelle24" \
    -xrm "*fontMenu*font2*Label:" \
    -xrm "*VT100*font2:" \
    -xrm "*fontMenu*font3*Label:" \
    -xrm "*VT100*font3:" \
    -xrm "*fontMenu*font4*Label:" \
    -xrm "*VT100*font4:" \
    -xrm "*fontMenu*font5*Label:" \
    -xrm "*VT100*font5:" \
    -xrm "*fontMenu*font6*Label:" \
    -xrm "*VT100*font6:" \
    -e $ISABELLE -m isabelle_font -m symbols $PASS "$@"
fi