lib/Tools/doc
author wenzelm
Fri, 10 Nov 2000 19:02:37 +0100
changeset 10432 3dfbc913d184
parent 9788 df671fa2562a
child 10511 efb3428c9879
permissions -rwxr-xr-x
added axclass inverse and consts inverse, divide (infix "/"); moved axclass power to Nat.thy;

#!/bin/bash
#
# $Id$
# Author: Markus Wenzel, TU Muenchen
# License: GPL (GNU GENERAL PUBLIC LICENSE)
#
# DESCRIPTION: view Isabelle documentation


PRG=$(basename "$0")

function usage()
{
  echo
  echo "Usage: $PRG [DOC]"
  echo
  echo "  View Isabelle documentation DOC, or show list of available documents."
  echo
  exit 1
}

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


## args

DOC=""
[ "$#" -ge 1 ] && { DOC="$1"; shift; }

[ "$#" -ne 0 -o "$DOC" = "-?" ] && usage


## main

if [ -z "$DOC" ]; then
  ORIG_IFS="$IFS"
  IFS=":"
  for DIR in $ISABELLE_DOCS
  do
    [ -f "$DIR/Contents" ] && grep -v "^>>" "$DIR/Contents"
  done
  IFS="$ORIG_IFS"
else
  ORIG_IFS="$IFS"
  IFS=":"
  for DIR in $ISABELLE_DOCS
  do
    [ -f "$DIR/$DOC.dvi" ] && { cd "$DIR"; IFS="$ORIG_IFS"; exec $DVI_VIEWER "$DOC.dvi"; }
  done
  IFS="$ORIG_IFS"
  fail "Unknown Isabelle document: $DOC"  
fi