lib/Tools/doc
author wenzelm
Fri, 07 Mar 1997 11:48:46 +0100
changeset 2754 59bd96046ad6
parent 2332 ae592411c199
child 2916 d761a62da697
permissions -rwxr-xr-x
moved settings comment to build;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2332
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
     1
#!/bin/bash -norc
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
     2
#
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
     3
# $Id$
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
     4
#
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
     5
# DESCRIPTION: view Isabelle documentation
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
     6
#
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
     7
# TODO:
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
     8
#  - other formats than dvi (??)
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
     9
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    10
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    11
PRG=$(basename $0)
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    12
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    13
function usage()
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    14
{
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    15
  echo
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    16
  echo "Usage: $PRG [DOC]"
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    17
  echo
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    18
  echo "  View Isabelle documentation DOC, or show list of available documents."
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    19
  echo
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    20
  exit 1
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    21
}
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    22
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    23
function fail()
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    24
{
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    25
  echo "$1" >&2
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    26
  exit 2
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    27
}
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    28
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    29
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    30
## args
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    31
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    32
DOC=""
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    33
[ $# -ge 1 ] && { DOC="$1"; shift }
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    34
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    35
[ $# -ne 0 -o "$DOC" = "-?" ] && usage
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    36
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    37
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    38
## main
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    39
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    40
if [ -z "$DOC" ]; then
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    41
  for DIR in $ISABELLE_DOCS
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    42
  do
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    43
    [ -f $DIR/Contents ] && cat $DIR/Contents
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    44
  done
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    45
else
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    46
  for DIR in $ISABELLE_DOCS
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    47
  do
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    48
    [ -f $DIR/$DOC.dvi ] && exec $DVI_VIEWER $DIR/$DOC.dvi
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    49
  done
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    50
  fail "Unknown Isabelle document: $DOC"  
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    51
fi