lib/scripts/run-polyml-4.2.0
author wenzelm
Sat, 10 Jan 2009 21:32:30 +0100
changeset 29435 a5f84ac14609
parent 29145 b1c6f4563df7
permissions -rwxr-xr-x
added parallel_proofs flag (default true, cf. usedir option -Q), which can be disabled in low-memory situations;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26215
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
     2
#
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
     3
# Author: Markus Wenzel, TU Muenchen
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
     4
#
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
     5
# Poly/ML 4.x startup script.
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
     6
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
     7
export -n INFILE OUTFILE COPYDB COMPRESS MLTEXT TERMINATE NOWRITE
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
     8
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
     9
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    10
## diagnostics
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    11
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    12
function fail_out()
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    13
{
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    14
  echo "Unable to create output heap file: \"$OUTFILE\"" >&2
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    15
  exit 2
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    16
}
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    17
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    18
function check_file()
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    19
{
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    20
  if [ ! -f "$1" ]; then
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    21
    echo "Unable to locate $1" >&2
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    22
    echo "Please check your ML system settings!" >&2
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    23
    exit 2
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    24
  fi
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    25
}
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    26
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    27
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    28
## Poly/ML executable and database
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    29
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    30
ML_DBASE_PREFIX=""
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    31
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    32
POLY="$ML_HOME/poly"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    33
check_file "$POLY"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    34
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    35
if [ -z "$ML_DBASE" ]; then
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    36
  if [ ! -e "$ML_HOME/ML_dbase" -a "$(basename "$ML_HOME")" = bin ]; then
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    37
    ML_DBASE_HOME="$(cd "$ML_HOME"; cd "$(pwd -P)"; cd ../lib/poly; pwd)"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    38
  else
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    39
    ML_DBASE_HOME="$ML_HOME"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    40
  fi
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    41
  if [ -z "$COPYDB" ]; then
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    42
    ML_DBASE_PREFIX="$ML_DBASE_HOME/"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    43
    ML_DBASE="ML_dbase"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    44
  else
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    45
    ML_DBASE="$ML_DBASE_HOME/ML_dbase"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    46
  fi
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    47
  export POLYPATH="$ML_DBASE_HOME"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    48
else
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    49
  export POLYPATH="$(dirname "$ML_DBASE")"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    50
fi
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    51
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    52
DISCGARB_OPTIONS="-d -c"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    53
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    54
EXIT="fun exit 0 = (OS.Process.exit OS.Process.success): unit | exit _ = OS.Process.exit OS.Process.failure;"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    55
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    56
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    57
## prepare databases
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    58
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    59
if [ -z "$INFILE" ]; then
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    60
  check_file "$ML_DBASE_PREFIX$ML_DBASE"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    61
  INFILE="$ML_DBASE"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    62
  MLTEXT="val use = PolyML.use; $EXIT $MLTEXT"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    63
  DISCGARB_OPTIONS="$DISCGARB_OPTIONS -S max"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    64
else
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    65
  COPYDB=true
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    66
fi
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    67
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    68
if [ -z "$OUTFILE" ]; then
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    69
  DB="$INFILE"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    70
  ML_OPTIONS="-r $ML_OPTIONS"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    71
elif [ "$INFILE" -ef "$OUTFILE" ]; then
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    72
  DB="$INFILE"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    73
elif [ -n "$COPYDB" ]; then
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    74
  [ -f "$OUTFILE" ] && { rm -f "$OUTFILE" || fail_out; }
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    75
  cp "$INFILE" "$OUTFILE" || fail_out
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    76
  chmod +w "$OUTFILE" || fail_out
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    77
  DB="$OUTFILE"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    78
else
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    79
  [ -f "$OUTFILE" ] && { rm -f "$OUTFILE" || fail_out; }
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    80
  echo "PolyML.make_database \"$OUTFILE\"; PolyML.quit();" | "$POLY" -r "$INFILE"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    81
  [ -f "$OUTFILE" ] || fail_out
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    82
  DB="$OUTFILE"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    83
fi
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    84
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    85
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    86
## run it!
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    87
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    88
if [ -z "$TERMINATE" ]; then
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    89
  FEEDER_OPTS=""
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    90
else
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    91
  FEEDER_OPTS="-q"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    92
fi
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    93
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    94
DB_INFO="$(ls -l "$DB" 2>/dev/null)"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    95
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    96
"$ISABELLE_HOME/lib/scripts/feeder" -p -h "$MLTEXT" $FEEDER_OPTS | {
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    97
  read FPID; "$POLY" $ML_OPTIONS "$DB";
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    98
  RC="$?"; kill -HUP "$FPID"; exit "$RC"; }
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
    99
RC="$?"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
   100
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
   101
NEW_DB_INFO="$(ls -l "$DB" 2>/dev/null)"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
   102
[ -n "$OUTFILE" -a -n "$COMPRESS" -a "$DB_INFO" != "$NEW_DB_INFO" ] && \
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
   103
  "$POLY" $DISCGARB_OPTIONS "$OUTFILE"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
   104
[ -n "$OUTFILE" -a -f "$OUTFILE" -a -n "$NOWRITE" ] && chmod -w "$OUTFILE"
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
   105
94d32a7cd0fb rearrangements to make latest Poly/ML the default, not old 4.x;
wenzelm
parents:
diff changeset
   106
exit "$RC"