lib/Tools/usedir
author wenzelm
Wed, 01 Feb 2006 22:20:40 +0100
changeset 18888 3b643f81b378
parent 18321 3414557c2dda
child 23972 9c418fa38f7e
permissions -rwxr-xr-x
updated;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10555
2323ec838401 /usr/bin/env bash;
wenzelm
parents: 10511
diff changeset
     1
#!/usr/bin/env bash
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
     2
#
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
     3
# $Id$
9788
wenzelm
parents: 9237
diff changeset
     4
# Author: Markus Wenzel, TU Muenchen
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
     5
#
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
     6
# DESCRIPTION: build object-logic or run examples
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
     7
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
     8
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
     9
## diagnostics
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    10
10511
wenzelm
parents: 9788
diff changeset
    11
PRG="$(basename "$0")"
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    12
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    13
function usage()
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    14
{
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    15
  echo
9237
161fb7f00414 fixed usage;
wenzelm
parents: 9047
diff changeset
    16
  echo "Usage: $PRG [OPTIONS] LOGIC NAME"
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    17
  echo
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    18
  echo "  Options are:"
17194
70d96933c210 added option -C: copy existing document directory;
wenzelm
parents: 17050
diff changeset
    19
  echo "    -C BOOL      copy existing document directory to -D PATH (default true)"
8197
baab8e487fad -D PATH: dump generated document sources into PATH;
wenzelm
parents: 7888
diff changeset
    20
  echo "    -D PATH      dump generated document sources into PATH"
6940
ee6640456cbb -B option;
wenzelm
parents: 6652
diff changeset
    21
  echo "    -P PATH      set path for remote theory browsing information"
17050
bfb571252817 added option -V VERSION;
wenzelm
parents: 15474
diff changeset
    22
  echo "    -V VERSION   declare alternative document VERSION"
6212
974310f9ca7d Session.init;
wenzelm
parents: 5034
diff changeset
    23
  echo "    -b           build mode (output heap image, using current dir)"
8359
124ad46105dd option -c: tell ML system to compress output image;
wenzelm
parents: 8241
diff changeset
    24
  echo "    -c BOOL      tell ML system to compress output image (default true)"
7737
acaf55bee03e document preparation options: -c -d;
wenzelm
parents: 7461
diff changeset
    25
  echo "    -d FORMAT    build document as FORMAT (default false)"
15269
f856f4f3258f isatool usedir: ML root file can now be specified (previously hard-coded as ROOT.ML)
webertj
parents: 14981
diff changeset
    26
  echo "    -f NAME      use ML file NAME (default ROOT.ML)"
11847
82df5977101b option -g for document graph;
wenzelm
parents: 11577
diff changeset
    27
  echo "    -g BOOL      generate session graph image for document (default false)"
82df5977101b option -g for document graph;
wenzelm
parents: 11577
diff changeset
    28
  echo "    -i BOOL      generate HTML and graph browser information (default false)"
10562
fcd29e58c40c option -m;
wenzelm
parents: 10555
diff changeset
    29
  echo "    -m MODE      add print mode for output"
11535
7f4c5cdea239 Added new option for setting level of detail for proof objects.
berghofe
parents: 10585
diff changeset
    30
  echo "    -p LEVEL     set level of detail for proof objects"
6212
974310f9ca7d Session.init;
wenzelm
parents: 5034
diff changeset
    31
  echo "    -r           reset session path"
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    32
  echo "    -s NAME      override session NAME"
11577
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    33
  echo "    -v BOOL      be verbose (default false)"
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    34
  echo
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    35
  echo "  Build object-logic or run examples. Also creates browsing"
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    36
  echo "  information (HTML etc.) according to settings."
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    37
  echo
7461
94ae093f6706 usage: tell ISABELLE_USEDIR_OPTIONS;
wenzelm
parents: 7276
diff changeset
    38
  echo "  ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS"
94ae093f6706 usage: tell ISABELLE_USEDIR_OPTIONS;
wenzelm
parents: 7276
diff changeset
    39
  echo
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    40
  exit 1
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    41
}
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    42
11577
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    43
function fail()
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    44
{
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    45
  echo "$1" >&2
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    46
  exit 2
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    47
}
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    48
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    49
function check_bool()
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    50
{
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    51
  [ "$1" = true -o "$1" = false ] || fail "Bad boolean: \"$1\""
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    52
}
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    53
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    54
function check_number()
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    55
{
12912
0e144958cf27 tr: quote argument;
wenzelm
parents: 11949
diff changeset
    56
  [ -n "$1" -a -z "$(echo "$1" | tr -d '[0-9]')" ] || fail "Bad number: \"$1\""
11577
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    57
}
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    58
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    59
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    60
## process command line
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    61
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    62
# options
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    63
17194
70d96933c210 added option -C: copy existing document directory;
wenzelm
parents: 17050
diff changeset
    64
COPY_DUMP="true"
8197
baab8e487fad -D PATH: dump generated document sources into PATH;
wenzelm
parents: 7888
diff changeset
    65
DUMP=""
baab8e487fad -D PATH: dump generated document sources into PATH;
wenzelm
parents: 7888
diff changeset
    66
RPATH=""
17050
bfb571252817 added option -V VERSION;
wenzelm
parents: 15474
diff changeset
    67
DOCUMENT_VERSIONS=""
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    68
BUILD=""
8747
22580c8bc62f fixed -c default value;
wenzelm
parents: 8568
diff changeset
    69
COMPRESS=true
7737
acaf55bee03e document preparation options: -c -d;
wenzelm
parents: 7461
diff changeset
    70
DOCUMENT=false
17050
bfb571252817 added option -V VERSION;
wenzelm
parents: 15474
diff changeset
    71
ROOT_FILE="ROOT.ML"
11847
82df5977101b option -g for document graph;
wenzelm
parents: 11577
diff changeset
    72
DOCUMENT_GRAPH=false
3747
cd9b6c86926c There is now one single option -i for generating theory browsing
berghofe
parents: 3636
diff changeset
    73
INFO=false
10562
fcd29e58c40c option -m;
wenzelm
parents: 10555
diff changeset
    74
MODES=""
6212
974310f9ca7d Session.init;
wenzelm
parents: 5034
diff changeset
    75
RESET=false
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    76
SESSION=""
11543
d61b913431c5 renamed `keep_derivs' to `proofs', and made an integer;
wenzelm
parents: 11535
diff changeset
    77
PROOFS=0
11577
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
    78
VERBOSE=false
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
    79
2917
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
    80
function getoptions()
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
    81
{
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
    82
  OPTIND=1
17194
70d96933c210 added option -C: copy existing document directory;
wenzelm
parents: 17050
diff changeset
    83
  while getopts "C:D:P:V:bc:d:f:g:i:m:p:rs:v:" OPT
2917
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
    84
  do
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
    85
    case "$OPT" in
17194
70d96933c210 added option -C: copy existing document directory;
wenzelm
parents: 17050
diff changeset
    86
      C)
70d96933c210 added option -C: copy existing document directory;
wenzelm
parents: 17050
diff changeset
    87
        check_bool "$OPTARG"
70d96933c210 added option -C: copy existing document directory;
wenzelm
parents: 17050
diff changeset
    88
        COPY_DUMP="$OPTARG"
70d96933c210 added option -C: copy existing document directory;
wenzelm
parents: 17050
diff changeset
    89
        ;;
8197
baab8e487fad -D PATH: dump generated document sources into PATH;
wenzelm
parents: 7888
diff changeset
    90
      D)
baab8e487fad -D PATH: dump generated document sources into PATH;
wenzelm
parents: 7888
diff changeset
    91
        DUMP="$OPTARG"
baab8e487fad -D PATH: dump generated document sources into PATH;
wenzelm
parents: 7888
diff changeset
    92
        ;;
baab8e487fad -D PATH: dump generated document sources into PATH;
wenzelm
parents: 7888
diff changeset
    93
      P)
baab8e487fad -D PATH: dump generated document sources into PATH;
wenzelm
parents: 7888
diff changeset
    94
        RPATH="$OPTARG"
baab8e487fad -D PATH: dump generated document sources into PATH;
wenzelm
parents: 7888
diff changeset
    95
        ;;
17050
bfb571252817 added option -V VERSION;
wenzelm
parents: 15474
diff changeset
    96
      V)
bfb571252817 added option -V VERSION;
wenzelm
parents: 15474
diff changeset
    97
        if [ -z "$DOCUMENT_VERSIONS" ]; then
bfb571252817 added option -V VERSION;
wenzelm
parents: 15474
diff changeset
    98
          DOCUMENT_VERSIONS="\"$OPTARG\""
bfb571252817 added option -V VERSION;
wenzelm
parents: 15474
diff changeset
    99
        else
bfb571252817 added option -V VERSION;
wenzelm
parents: 15474
diff changeset
   100
          DOCUMENT_VERSIONS="$DOCUMENT_VERSIONS, \"$OPTARG\""
bfb571252817 added option -V VERSION;
wenzelm
parents: 15474
diff changeset
   101
        fi
bfb571252817 added option -V VERSION;
wenzelm
parents: 15474
diff changeset
   102
        ;;
2917
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   103
      b)
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   104
        BUILD=true
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   105
        ;;
8359
124ad46105dd option -c: tell ML system to compress output image;
wenzelm
parents: 8241
diff changeset
   106
      c)
11577
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
   107
        check_bool "$OPTARG"
8359
124ad46105dd option -c: tell ML system to compress output image;
wenzelm
parents: 8241
diff changeset
   108
        COMPRESS="$OPTARG"
124ad46105dd option -c: tell ML system to compress output image;
wenzelm
parents: 8241
diff changeset
   109
        ;;
7737
acaf55bee03e document preparation options: -c -d;
wenzelm
parents: 7461
diff changeset
   110
      d)
acaf55bee03e document preparation options: -c -d;
wenzelm
parents: 7461
diff changeset
   111
        DOCUMENT="$OPTARG"
acaf55bee03e document preparation options: -c -d;
wenzelm
parents: 7461
diff changeset
   112
        ;;
15269
f856f4f3258f isatool usedir: ML root file can now be specified (previously hard-coded as ROOT.ML)
webertj
parents: 14981
diff changeset
   113
      f)
f856f4f3258f isatool usedir: ML root file can now be specified (previously hard-coded as ROOT.ML)
webertj
parents: 14981
diff changeset
   114
        ROOT_FILE="$OPTARG"
f856f4f3258f isatool usedir: ML root file can now be specified (previously hard-coded as ROOT.ML)
webertj
parents: 14981
diff changeset
   115
        ;;
11847
82df5977101b option -g for document graph;
wenzelm
parents: 11577
diff changeset
   116
      g)
82df5977101b option -g for document graph;
wenzelm
parents: 11577
diff changeset
   117
        check_bool "$OPTARG"
82df5977101b option -g for document graph;
wenzelm
parents: 11577
diff changeset
   118
        DOCUMENT_GRAPH="$OPTARG"
82df5977101b option -g for document graph;
wenzelm
parents: 11577
diff changeset
   119
        ;;
3747
cd9b6c86926c There is now one single option -i for generating theory browsing
berghofe
parents: 3636
diff changeset
   120
      i)
11577
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
   121
        check_bool "$OPTARG"
3747
cd9b6c86926c There is now one single option -i for generating theory browsing
berghofe
parents: 3636
diff changeset
   122
        INFO="$OPTARG"
2917
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   123
        ;;
10562
fcd29e58c40c option -m;
wenzelm
parents: 10555
diff changeset
   124
      m)
fcd29e58c40c option -m;
wenzelm
parents: 10555
diff changeset
   125
        if [ -z "$MODES" ]; then
fcd29e58c40c option -m;
wenzelm
parents: 10555
diff changeset
   126
          MODES="\"$OPTARG\""
fcd29e58c40c option -m;
wenzelm
parents: 10555
diff changeset
   127
        else
10585
58a1ed1edb65 proper order of modes;
wenzelm
parents: 10562
diff changeset
   128
          MODES="\"$OPTARG\", $MODES"
10562
fcd29e58c40c option -m;
wenzelm
parents: 10555
diff changeset
   129
        fi
fcd29e58c40c option -m;
wenzelm
parents: 10555
diff changeset
   130
        ;;
11535
7f4c5cdea239 Added new option for setting level of detail for proof objects.
berghofe
parents: 10585
diff changeset
   131
      p)
11577
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
   132
        check_number "$OPTARG"
11543
d61b913431c5 renamed `keep_derivs' to `proofs', and made an integer;
wenzelm
parents: 11535
diff changeset
   133
        PROOFS="$OPTARG"
11535
7f4c5cdea239 Added new option for setting level of detail for proof objects.
berghofe
parents: 10585
diff changeset
   134
        ;;
6212
974310f9ca7d Session.init;
wenzelm
parents: 5034
diff changeset
   135
      r)
974310f9ca7d Session.init;
wenzelm
parents: 5034
diff changeset
   136
        RESET=true
974310f9ca7d Session.init;
wenzelm
parents: 5034
diff changeset
   137
        ;;
2917
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   138
      s)
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   139
        SESSION="$OPTARG"
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   140
        ;;
11577
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
   141
      v)
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
   142
        check_bool "$OPTARG"
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
   143
        VERBOSE="$OPTARG"
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
   144
        ;;
2917
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   145
      \?)
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   146
        usage
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   147
        ;;
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   148
    esac
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   149
  done
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   150
}
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   151
2917
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   152
getoptions $ISABELLE_USEDIR_OPTIONS
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   153
c7411fce37e4 added -g, -h options;
wenzelm
parents: 2849
diff changeset
   154
getoptions "$@"
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   155
shift $(($OPTIND - 1))
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   156
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   157
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   158
# args
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   159
9788
wenzelm
parents: 9237
diff changeset
   160
[ "$#" -ne 2 ] && usage
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   161
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   162
LOGIC="$1"; shift
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   163
NAME="$1"; shift
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   164
9788
wenzelm
parents: 9237
diff changeset
   165
[ -z "$SESSION" ] && SESSION=$(basename "$NAME")
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   166
4419
wenzelm
parents: 4075
diff changeset
   167
wenzelm
parents: 4075
diff changeset
   168
wenzelm
parents: 4075
diff changeset
   169
## main
3636
3f2e55e5bacc Added some code for generating theory browsing data.
berghofe
parents: 3504
diff changeset
   170
4451
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   171
# prepare browser info dir
4419
wenzelm
parents: 4075
diff changeset
   172
9788
wenzelm
parents: 9237
diff changeset
   173
if [ "$INFO" = "true" -a ! -f "$ISABELLE_BROWSER_INFO/index.html" ]; then
wenzelm
parents: 9237
diff changeset
   174
  mkdir -p "$ISABELLE_BROWSER_INFO"
wenzelm
parents: 9237
diff changeset
   175
  cp "$ISABELLE_HOME/lib/logo/isabelle.gif" "$ISABELLE_BROWSER_INFO/isabelle.gif"
wenzelm
parents: 9237
diff changeset
   176
  cp "$ISABELLE_HOME/lib/html/index.html" "$ISABELLE_BROWSER_INFO/index.html"
3636
3f2e55e5bacc Added some code for generating theory browsing data.
berghofe
parents: 3504
diff changeset
   177
fi
3f2e55e5bacc Added some code for generating theory browsing data.
berghofe
parents: 3504
diff changeset
   178
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   179
4451
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   180
# prepare log dir
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   181
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   182
LOGDIR="$ISABELLE_OUTPUT/log"
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   183
mkdir -p "$LOGDIR"
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   184
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   185
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   186
# run isabelle
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   187
7737
acaf55bee03e document preparation options: -c -d;
wenzelm
parents: 7461
diff changeset
   188
PARENT=$(basename "$LOGIC")
acaf55bee03e document preparation options: -c -d;
wenzelm
parents: 7461
diff changeset
   189
11949
wenzelm
parents: 11907
diff changeset
   190
if [ -z "$BUILD" ]; then
wenzelm
parents: 11907
diff changeset
   191
  cd "$NAME" || fail "Bad session directory '$NAME'"
wenzelm
parents: 11907
diff changeset
   192
fi
4451
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   193
11847
82df5977101b option -g for document graph;
wenzelm
parents: 11577
diff changeset
   194
if [ "$DOCUMENT" != false ]; then
8568
wenzelm
parents: 8565
diff changeset
   195
  DOC="$DOCUMENT"
wenzelm
parents: 8565
diff changeset
   196
else
wenzelm
parents: 8565
diff changeset
   197
  DOC=""
wenzelm
parents: 8565
diff changeset
   198
fi
7737
acaf55bee03e document preparation options: -c -d;
wenzelm
parents: 7461
diff changeset
   199
acaf55bee03e document preparation options: -c -d;
wenzelm
parents: 7461
diff changeset
   200
18321
3414557c2dda replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents: 17194
diff changeset
   201
. "$ISABELLE_HOME/lib/scripts/timestart.bash"
6249
8bb90076cc7c Session.use_dir: check parent;
wenzelm
parents: 6212
diff changeset
   202
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   203
if [ -n "$BUILD" ]; then
4451
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   204
  ITEM="$SESSION"
11577
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
   205
  echo "Building $ITEM ..." >&2
4451
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   206
  LOG="$LOGDIR/$ITEM"
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   207
8359
124ad46105dd option -c: tell ML system to compress output image;
wenzelm
parents: 8241
diff changeset
   208
  OPT_C=""
124ad46105dd option -c: tell ML system to compress output image;
wenzelm
parents: 8241
diff changeset
   209
  [ "$COMPRESS" = true ] && OPT_C="-c"
124ad46105dd option -c: tell ML system to compress output image;
wenzelm
parents: 8241
diff changeset
   210
9788
wenzelm
parents: 9237
diff changeset
   211
  "$ISABELLE" \
17194
70d96933c210 added option -C: copy existing document directory;
wenzelm
parents: 17050
diff changeset
   212
    -e "Session.use_dir \"$ROOT_FILE\" true [$MODES] $RESET $INFO \"$DOC\" $DOCUMENT_GRAPH [$DOCUMENT_VERSIONS] \"$PARENT\" \"$SESSION\" ($COPY_DUMP, \"$DUMP\") \"$RPATH\" $PROOFS $VERBOSE;" \
11577
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
   213
    $OPT_C -q -w $LOGIC $NAME > "$LOG"
9788
wenzelm
parents: 9237
diff changeset
   214
  RC="$?"
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   215
else
9788
wenzelm
parents: 9237
diff changeset
   216
  ITEM=$(basename "$LOGIC")-"$SESSION"
11577
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
   217
  echo "Running $ITEM ..." >&2
4451
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   218
  LOG="$LOGDIR/$ITEM"
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   219
9788
wenzelm
parents: 9237
diff changeset
   220
  "$ISABELLE" \
17194
70d96933c210 added option -C: copy existing document directory;
wenzelm
parents: 17050
diff changeset
   221
    -e "Session.use_dir \"$ROOT_FILE\" false [$MODES] $RESET $INFO \"$DOC\" $DOCUMENT_GRAPH [$DOCUMENT_VERSIONS] \"$PARENT\" \"$SESSION\" ($COPY_DUMP, \"$DUMP\") \"$RPATH\" $PROOFS $VERBOSE; quit();" \
11577
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
   222
    -r -q "$LOGIC" > "$LOG"
9788
wenzelm
parents: 9237
diff changeset
   223
  RC="$?"
6212
974310f9ca7d Session.init;
wenzelm
parents: 5034
diff changeset
   224
  cd ..
2808
e8a224e41b9f usedir -- build object-logic or run examples;
wenzelm
parents:
diff changeset
   225
fi
4451
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   226
18321
3414557c2dda replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents: 17194
diff changeset
   227
. "$ISABELLE_HOME/lib/scripts/timestop.bash"
4451
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   228
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   229
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   230
# exit status
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   231
9788
wenzelm
parents: 9237
diff changeset
   232
if [ "$RC" -eq 0 ]; then
18321
3414557c2dda replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents: 17194
diff changeset
   233
  echo "Finished $ITEM ($TIMES_REPORT)" >&2
4451
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   234
  gzip --force "$LOG"
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   235
else
11577
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
   236
  { echo "$ITEM FAILED";
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
   237
    echo "(see also $LOG)";
68323aa9575d option -v;
wenzelm
parents: 11543
diff changeset
   238
    echo; tail "$LOG"; echo; } >&2
4451
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   239
fi
f9e3e9f1af61 log file;
wenzelm
parents: 4419
diff changeset
   240
9788
wenzelm
parents: 9237
diff changeset
   241
exit "$RC"