lib/Tools/doc
author wenzelm
Thu, 17 Jul 1997 15:03:38 +0200
changeset 3524 c02cb15830de
parent 3173 0013af1bc2c4
child 8130 b077b79061b6
permissions -rwxr-xr-x
fixed EqI meta rule;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3007
e5efa177ee0c removed -norc;
wenzelm
parents: 2940
diff changeset
     1
#!/bin/bash
2332
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
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
     8
PRG=$(basename $0)
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
     9
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    10
function usage()
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    11
{
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    12
  echo
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    13
  echo "Usage: $PRG [DOC]"
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    14
  echo
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    15
  echo "  View Isabelle documentation DOC, or show list of available documents."
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    16
  echo
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    17
  exit 1
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    18
}
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    19
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    20
function fail()
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    21
{
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    22
  echo "$1" >&2
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    23
  exit 2
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    24
}
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    25
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    26
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    27
## args
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    28
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    29
DOC=""
2936
bd33e7aae062 fixed { ... } shell syntax to accomodate bash 2.x;
wenzelm
parents: 2916
diff changeset
    30
[ $# -ge 1 ] && { DOC="$1"; shift; }
2332
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    31
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    32
[ $# -ne 0 -o "$DOC" = "-?" ] && usage
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    33
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    34
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    35
## main
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    36
3173
0013af1bc2c4 fixed ISABELLE_DOCS multiple components;
wenzelm
parents: 3007
diff changeset
    37
DOCS=$(echo $ISABELLE_DOCS | tr : " ")
0013af1bc2c4 fixed ISABELLE_DOCS multiple components;
wenzelm
parents: 3007
diff changeset
    38
2332
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    39
if [ -z "$DOC" ]; then
3173
0013af1bc2c4 fixed ISABELLE_DOCS multiple components;
wenzelm
parents: 3007
diff changeset
    40
  for DIR in $DOCS
2332
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    41
  do
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    42
    [ -f $DIR/Contents ] && cat $DIR/Contents
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    43
  done
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    44
else
3173
0013af1bc2c4 fixed ISABELLE_DOCS multiple components;
wenzelm
parents: 3007
diff changeset
    45
  for DIR in $DOCS
2332
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    46
  do
2936
bd33e7aae062 fixed { ... } shell syntax to accomodate bash 2.x;
wenzelm
parents: 2916
diff changeset
    47
    [ -f $DIR/$DOC.dvi ] && { cd $DIR; exec $DVI_VIEWER $DOC.dvi; }
2332
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    48
  done
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    49
  fail "Unknown Isabelle document: $DOC"  
ae592411c199 doc: view Isabelle documentation;
wenzelm
parents:
diff changeset
    50
fi