bin/isabelle
author paulson
Mon, 06 Aug 2001 12:42:43 +0200
changeset 11461 ffeac9aa1967
parent 10905 e23abeef8150
child 11550 915c5de6480f
permissions -rwxr-xr-x
removed an unsuitable default simprule
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
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
     2
#
2308
641be5ad47af improved 'not found' messages;
wenzelm
parents: 2292
diff changeset
     3
# $Id$
9786
wenzelm
parents: 8359
diff changeset
     4
# Author: Markus Wenzel, TU Muenchen
wenzelm
parents: 8359
diff changeset
     5
# License: GPL (GNU GENERAL PUBLIC LICENSE)
2308
641be5ad47af improved 'not found' messages;
wenzelm
parents: 2292
diff changeset
     6
#
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
     7
# Basic Isabelle startup script.
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
     8
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
     9
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    10
## settings
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    11
10511
wenzelm
parents: 10104
diff changeset
    12
PRG="$(basename "$0")"
2704
afa01c9f1ab0 more robust handling of invocation errors;
wenzelm
parents: 2591
diff changeset
    13
10511
wenzelm
parents: 10104
diff changeset
    14
ISABELLE_HOME="$(dirname "$0")/.."
9786
wenzelm
parents: 8359
diff changeset
    15
. "$ISABELLE_HOME/lib/scripts/getsettings" || \
2936
bd33e7aae062 fixed { ... } shell syntax to accomodate bash 2.x;
wenzelm
parents: 2768
diff changeset
    16
  { echo "$PRG probably not called from its original place!"; exit 2; }
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    17
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    18
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    19
## diagnostics
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    20
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    21
function usage()
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    22
{
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    23
  echo
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    24
  echo "Usage: $PRG [OPTIONS] [INPUT] [OUTPUT]"
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    25
  echo
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    26
  echo "  Options are:"
10104
cf49932f3c42 option -C;
wenzelm
parents: 9982
diff changeset
    27
  echo "    -C           tell ML system to copy output image"
5815
b4d4a97df438 option -I: startup Isar interaction mode;
wenzelm
parents: 4539
diff changeset
    28
  echo "    -I           startup Isar interaction mode"
9982
1860276fc8de tuned msg;
wenzelm
parents: 9972
diff changeset
    29
  echo "    -P           startup Proof General interaction mode"
8359
124ad46105dd option -c: tell ML system to compress output image;
wenzelm
parents: 7887
diff changeset
    30
  echo "    -c           tell ML system to compress output image"
2343
2588b63b42ca added -norc option;
wenzelm
parents: 2308
diff changeset
    31
  echo "    -e MLTEXT    pass MLTEXT to the ML session"
10905
e23abeef8150 -f option;
wenzelm
parents: 10585
diff changeset
    32
  echo "    -f           pass 'Session.finish();' to the ML session"
2704
afa01c9f1ab0 more robust handling of invocation errors;
wenzelm
parents: 2591
diff changeset
    33
  echo "    -m MODE      add print mode for output"
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    34
  echo "    -q           non-interactive session"
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    35
  echo "    -r           open heap file read-only"
4516
f90b2d459a1b added -u option (again);
wenzelm
parents: 4355
diff changeset
    36
  echo "    -u           pass 'use\"ROOT.ML\";' to the ML session"
3502
ec22ba0a26ec added -w option;
wenzelm
parents: 3203
diff changeset
    37
  echo "    -w           reset write permissions on OUTPUT"
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    38
  echo
3184
4e0bbfb113d5 renamed DEFAULT_LOGIC to ISABELLE_LOGIC;
wenzelm
parents: 3183
diff changeset
    39
  echo "  INPUT (default \"$ISABELLE_LOGIC\") and OUTPUT specify in/out heaps."
7887
eedfff88ee40 tuned usage;
wenzelm
parents: 6286
diff changeset
    40
  echo "  These are either names to be searched in the Isabelle path, or"
eedfff88ee40 tuned usage;
wenzelm
parents: 6286
diff changeset
    41
  echo "  actual file names (containing at least one /)."
2768
bc6d915b8019 renamed SYSTEM to RAW_ML_SYSTEM;
wenzelm
parents: 2735
diff changeset
    42
  echo "  If INPUT is \"RAW_ML_SYSTEM\", just start the bare bones ML system."
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    43
  echo
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    44
  exit 1
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    45
}
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    46
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    47
function fail()
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    48
{
2343
2588b63b42ca added -norc option;
wenzelm
parents: 2308
diff changeset
    49
  echo "$1" >&2
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    50
  exit 2
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    51
}
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    52
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    53
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    54
## process command line
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    55
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    56
# options
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    57
10104
cf49932f3c42 option -C;
wenzelm
parents: 9982
diff changeset
    58
COPYDB=""
9972
05afcc505da3 -P option;
wenzelm
parents: 9786
diff changeset
    59
ISAR=false
05afcc505da3 -P option;
wenzelm
parents: 9786
diff changeset
    60
PROOFGENERAL=""
8359
124ad46105dd option -c: tell ML system to compress output image;
wenzelm
parents: 7887
diff changeset
    61
COMPRESS=""
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    62
MLTEXT=""
2704
afa01c9f1ab0 more robust handling of invocation errors;
wenzelm
parents: 2591
diff changeset
    63
MODES=""
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    64
TERMINATE=""
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    65
READONLY=""
3502
ec22ba0a26ec added -w option;
wenzelm
parents: 3203
diff changeset
    66
NOWRITE=""
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    67
10905
e23abeef8150 -f option;
wenzelm
parents: 10585
diff changeset
    68
while getopts "CIPce:fm:qruw" OPT
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    69
do
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    70
  case "$OPT" in
10104
cf49932f3c42 option -C;
wenzelm
parents: 9982
diff changeset
    71
    C)
cf49932f3c42 option -C;
wenzelm
parents: 9982
diff changeset
    72
      COPYDB=true
cf49932f3c42 option -C;
wenzelm
parents: 9982
diff changeset
    73
      ;;
5815
b4d4a97df438 option -I: startup Isar interaction mode;
wenzelm
parents: 4539
diff changeset
    74
    I)
9972
05afcc505da3 -P option;
wenzelm
parents: 9786
diff changeset
    75
      ISAR=true
05afcc505da3 -P option;
wenzelm
parents: 9786
diff changeset
    76
      ;;
05afcc505da3 -P option;
wenzelm
parents: 9786
diff changeset
    77
    P)
05afcc505da3 -P option;
wenzelm
parents: 9786
diff changeset
    78
      PROOFGENERAL=true
5815
b4d4a97df438 option -I: startup Isar interaction mode;
wenzelm
parents: 4539
diff changeset
    79
      ;;
8359
124ad46105dd option -c: tell ML system to compress output image;
wenzelm
parents: 7887
diff changeset
    80
    c)
124ad46105dd option -c: tell ML system to compress output image;
wenzelm
parents: 7887
diff changeset
    81
      COMPRESS=true
124ad46105dd option -c: tell ML system to compress output image;
wenzelm
parents: 7887
diff changeset
    82
      ;;
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    83
    e)
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    84
      MLTEXT="$MLTEXT $OPTARG"
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    85
      ;;
10905
e23abeef8150 -f option;
wenzelm
parents: 10585
diff changeset
    86
    f)
e23abeef8150 -f option;
wenzelm
parents: 10585
diff changeset
    87
      MLTEXT="$MLTEXT Session.finish();"
e23abeef8150 -f option;
wenzelm
parents: 10585
diff changeset
    88
      ;;
2704
afa01c9f1ab0 more robust handling of invocation errors;
wenzelm
parents: 2591
diff changeset
    89
    m)
afa01c9f1ab0 more robust handling of invocation errors;
wenzelm
parents: 2591
diff changeset
    90
      if [ -z "$MODES" ]; then
afa01c9f1ab0 more robust handling of invocation errors;
wenzelm
parents: 2591
diff changeset
    91
        MODES="\"$OPTARG\""
afa01c9f1ab0 more robust handling of invocation errors;
wenzelm
parents: 2591
diff changeset
    92
      else
10585
58a1ed1edb65 proper order of modes;
wenzelm
parents: 10555
diff changeset
    93
        MODES="\"$OPTARG\", $MODES"
2704
afa01c9f1ab0 more robust handling of invocation errors;
wenzelm
parents: 2591
diff changeset
    94
      fi
afa01c9f1ab0 more robust handling of invocation errors;
wenzelm
parents: 2591
diff changeset
    95
      ;;
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    96
    q)
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    97
      TERMINATE=true
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    98
      ;;
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
    99
    r)
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   100
      READONLY=true
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   101
      ;;
4516
f90b2d459a1b added -u option (again);
wenzelm
parents: 4355
diff changeset
   102
    u)
f90b2d459a1b added -u option (again);
wenzelm
parents: 4355
diff changeset
   103
      MLTEXT="$MLTEXT use\"ROOT.ML\";"
f90b2d459a1b added -u option (again);
wenzelm
parents: 4355
diff changeset
   104
      ;;
3502
ec22ba0a26ec added -w option;
wenzelm
parents: 3203
diff changeset
   105
    w)
ec22ba0a26ec added -w option;
wenzelm
parents: 3203
diff changeset
   106
      NOWRITE=true
ec22ba0a26ec added -w option;
wenzelm
parents: 3203
diff changeset
   107
      ;;
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   108
    \?)
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   109
      usage
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   110
      ;;
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   111
  esac
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   112
done
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   113
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   114
shift $(($OPTIND - 1))
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   115
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   116
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   117
# args
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   118
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   119
INPUT=""
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   120
OUTPUT=""
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   121
9786
wenzelm
parents: 8359
diff changeset
   122
if [ "$#" -ge 1 ]; then
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   123
  INPUT="$1"
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   124
  shift
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   125
fi
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   126
9786
wenzelm
parents: 8359
diff changeset
   127
if [ "$#" -ge 1 ]; then
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   128
  OUTPUT="$1"
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   129
  shift
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   130
fi
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   131
9786
wenzelm
parents: 8359
diff changeset
   132
[ "$#" -ne 0 ] && { echo "Bad args: $*"; usage; }
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   133
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   134
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   135
## check ML system
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   136
2308
641be5ad47af improved 'not found' messages;
wenzelm
parents: 2292
diff changeset
   137
[ -z "$ML_SYSTEM" ] && fail "Missing ML system settings! Unable to run Isabelle."
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   138
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   139
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   140
## input heap file
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   141
3184
4e0bbfb113d5 renamed DEFAULT_LOGIC to ISABELLE_LOGIC;
wenzelm
parents: 3183
diff changeset
   142
[ -z "$INPUT" ] && INPUT="$ISABELLE_LOGIC"
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   143
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   144
case "$INPUT" in
2768
bc6d915b8019 renamed SYSTEM to RAW_ML_SYSTEM;
wenzelm
parents: 2735
diff changeset
   145
  RAW_ML_SYSTEM)
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   146
    INFILE=""
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   147
    ;;
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   148
  */*)
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   149
    INFILE="$INPUT"
2343
2588b63b42ca added -norc option;
wenzelm
parents: 2308
diff changeset
   150
    [ ! -f "$INFILE" ] && fail "Bad heap file: \"$INFILE\""
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   151
    ;;
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   152
  *)
9786
wenzelm
parents: 8359
diff changeset
   153
    INFILE=""
2308
641be5ad47af improved 'not found' messages;
wenzelm
parents: 2292
diff changeset
   154
    ISA_PATH=""
9786
wenzelm
parents: 8359
diff changeset
   155
wenzelm
parents: 8359
diff changeset
   156
    ORIG_IFS="$IFS"
wenzelm
parents: 8359
diff changeset
   157
    IFS=":"
wenzelm
parents: 8359
diff changeset
   158
    for DIR in $ISABELLE_PATH
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   159
    do
9786
wenzelm
parents: 8359
diff changeset
   160
      DIR="$DIR/$ML_IDENTIFIER"
wenzelm
parents: 8359
diff changeset
   161
      ISA_PATH="$ISA_PATH  $DIR\n"
wenzelm
parents: 8359
diff changeset
   162
      [ -z "$INFILE" -a -f "$DIR/$INPUT" ] && INFILE="$DIR/$INPUT"
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   163
    done
9786
wenzelm
parents: 8359
diff changeset
   164
    IFS="$ORIG_IFS"
wenzelm
parents: 8359
diff changeset
   165
2308
641be5ad47af improved 'not found' messages;
wenzelm
parents: 2292
diff changeset
   166
    if [ -z "$INFILE" ]; then
2343
2588b63b42ca added -norc option;
wenzelm
parents: 2308
diff changeset
   167
      echo "Unknown logic \"$INPUT\" -- no heap file found in:" >&2
9786
wenzelm
parents: 8359
diff changeset
   168
      echo -ne "$ISA_PATH" >&2
2308
641be5ad47af improved 'not found' messages;
wenzelm
parents: 2292
diff changeset
   169
      exit 2
641be5ad47af improved 'not found' messages;
wenzelm
parents: 2292
diff changeset
   170
    fi
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   171
    ;;
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   172
esac
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   173
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   174
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   175
## output heap file
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   176
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   177
case "$OUTPUT" in
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   178
  "")
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   179
    [ -z "$READONLY" -a -w "$INFILE" ] && OUTFILE="$INFILE"
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   180
    ;;
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   181
  */*)
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   182
    OUTFILE="$OUTPUT"
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   183
    ;;
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   184
  *)
3118
24dae6222579 fixed ISABELLE_OUTPUT, ISABELLE_PATH (finally?);
wenzelm
parents: 3054
diff changeset
   185
    mkdir -p "$ISABELLE_OUTPUT"
24dae6222579 fixed ISABELLE_OUTPUT, ISABELLE_PATH (finally?);
wenzelm
parents: 3054
diff changeset
   186
    OUTFILE="$ISABELLE_OUTPUT/$OUTPUT"
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   187
    ;;
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   188
esac
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   189
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   190
4333
1d326b826851 ISABELLE_TMP;
wenzelm
parents: 3502
diff changeset
   191
## prepare tmp directory
1d326b826851 ISABELLE_TMP;
wenzelm
parents: 3502
diff changeset
   192
1d326b826851 ISABELLE_TMP;
wenzelm
parents: 3502
diff changeset
   193
[ -z "$ISABELLE_TMP_PREFIX" ] && ISABELLE_TMP_PREFIX=/tmp/isabelle
1d326b826851 ISABELLE_TMP;
wenzelm
parents: 3502
diff changeset
   194
1d326b826851 ISABELLE_TMP;
wenzelm
parents: 3502
diff changeset
   195
ISABELLE_TMP="$ISABELLE_TMP_PREFIX$$"
1d326b826851 ISABELLE_TMP;
wenzelm
parents: 3502
diff changeset
   196
mkdir -p "$ISABELLE_TMP"
1d326b826851 ISABELLE_TMP;
wenzelm
parents: 3502
diff changeset
   197
1d326b826851 ISABELLE_TMP;
wenzelm
parents: 3502
diff changeset
   198
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   199
## run it!
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   200
9786
wenzelm
parents: 8359
diff changeset
   201
ML_SYSTEM_BASE=$(echo "$ML_SYSTEM" | cut -f1 -d-)
2292
c1c5652600f1 isabelle: Basic Isabelle startup script.
wenzelm
parents:
diff changeset
   202
2704
afa01c9f1ab0 more robust handling of invocation errors;
wenzelm
parents: 2591
diff changeset
   203
[ -n "$MODES" ] && MLTEXT="print_mode := [$MODES]; $MLTEXT"
afa01c9f1ab0 more robust handling of invocation errors;
wenzelm
parents: 2591
diff changeset
   204
9972
05afcc505da3 -P option;
wenzelm
parents: 9786
diff changeset
   205
if [ -n "$PROOFGENERAL" ]; then
05afcc505da3 -P option;
wenzelm
parents: 9786
diff changeset
   206
  MLTEXT="$MLTEXT; ProofGeneral.init $ISAR;"
05afcc505da3 -P option;
wenzelm
parents: 9786
diff changeset
   207
elif [ "$ISAR" = true ]; then
05afcc505da3 -P option;
wenzelm
parents: 9786
diff changeset
   208
  MLTEXT="$MLTEXT; Isar.main();"
05afcc505da3 -P option;
wenzelm
parents: 9786
diff changeset
   209
fi
05afcc505da3 -P option;
wenzelm
parents: 9786
diff changeset
   210
10104
cf49932f3c42 option -C;
wenzelm
parents: 9982
diff changeset
   211
export INFILE OUTFILE COPYDB COMPRESS MLTEXT TERMINATE NOWRITE ISABELLE_TMP
4333
1d326b826851 ISABELLE_TMP;
wenzelm
parents: 3502
diff changeset
   212
9786
wenzelm
parents: 8359
diff changeset
   213
if [ -f "$ISABELLE_HOME/lib/scripts/run-$ML_SYSTEM" ]; then
wenzelm
parents: 8359
diff changeset
   214
  "$ISABELLE_HOME/lib/scripts/run-$ML_SYSTEM"
4333
1d326b826851 ISABELLE_TMP;
wenzelm
parents: 3502
diff changeset
   215
else
9786
wenzelm
parents: 8359
diff changeset
   216
  "$ISABELLE_HOME/lib/scripts/run-$ML_SYSTEM_BASE"
4333
1d326b826851 ISABELLE_TMP;
wenzelm
parents: 3502
diff changeset
   217
fi
9786
wenzelm
parents: 8359
diff changeset
   218
RC="$?"
4333
1d326b826851 ISABELLE_TMP;
wenzelm
parents: 3502
diff changeset
   219
1d326b826851 ISABELLE_TMP;
wenzelm
parents: 3502
diff changeset
   220
#Do not even think of 'rm -r'!!
9786
wenzelm
parents: 8359
diff changeset
   221
rmdir "$ISABELLE_TMP"
4355
68c7c544570c pass return code!!
wenzelm
parents: 4333
diff changeset
   222
9786
wenzelm
parents: 8359
diff changeset
   223
exit "$RC"