Poly/ML 5.0 setup for Isabelle2005.
authorwenzelm
Thu, 07 Dec 2006 14:11:39 +0100
changeset 21688 e5287f12f1e1
parent 21687 f689f729afab
child 21689 58abd6d8abd1
Poly/ML 5.0 setup for Isabelle2005.
Admin/Isabelle2005-polyml-5.0/README-polyml-5.0
Admin/Isabelle2005-polyml-5.0/lib/scripts/run-polyml-5.0
Admin/Isabelle2005-polyml-5.0/src/Pure/ML-Systems/polyml-5.0.ML
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Admin/Isabelle2005-polyml-5.0/README-polyml-5.0	Thu Dec 07 14:11:39 2006 +0100
@@ -0,0 +1,23 @@
+
+Using Isabelle2005 with Poly/ML 5.0 requires the following
+compatibility wrappers:
+
+  Isabelle2005/src/Pure/ML-Systems/polyml-5.0.ML
+  Isabelle2005/lib/scripts/run-polyml-5.0
+
+Moreover the Isabelle settings need to specify that version, by
+including something like this in Isabelle2005/etc/settings or
+~/isabelle/etc/settings:
+
+ML_PLATFORM=""
+ML_HOME=/usr/local/bin
+ML_SYSTEM=polyml-5.0
+ML_OPTIONS="-H 500"
+
+Then logics can be compiled as usual, cf. the INSTALL instructions.
+
+
+	Makarius
+	07-Dec-2006
+
+$Id$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Admin/Isabelle2005-polyml-5.0/lib/scripts/run-polyml-5.0	Thu Dec 07 14:11:39 2006 +0100
@@ -0,0 +1,90 @@
+#!/usr/bin/env bash
+#
+# $Id$
+# Author: Makarius
+#
+# Poly/ML startup script (for 5.0)
+
+export -n INFILE OUTFILE COPYDB COMPRESS MLTEXT TERMINATE NOWRITE
+
+
+## diagnostics
+
+function fail_out()
+{
+  echo "Unable to create output heap file: \"$OUTFILE\"" >&2
+  exit 2
+}
+
+function check_file()
+{
+  if [ ! -f "$1" ]; then
+    echo "Unable to locate $1" >&2
+    echo "Please check your ML system settings!" >&2
+    exit 2
+  fi
+}
+
+
+## compiler executables and libraries
+
+POLY="$ML_HOME/poly"
+check_file "$POLY"
+
+if [ "$(basename "$ML_HOME")" = bin ]; then
+  POLYLIB="$(cd "$ML_HOME"; cd "$(pwd -P)"; cd ../lib; pwd)"
+else
+  POLYLIB="$ML_HOME"
+fi
+
+export LD_LIBRARY_PATH="$POLYLIB:$LD_LIBRARY_PATH"
+export DYLD_LIBRARY_PATH="$POLYLIB:$DYLD_LIBRARY_PATH"
+
+
+## prepare databases
+
+if [ -z "$INFILE" ]; then
+  EXIT="fun exit 0 = (OS.Process.exit OS.Process.success): unit | exit _ = OS.Process.exit OS.Process.failure;"
+else
+  check_file "$INFILE"
+  POLY="$INFILE"
+  EXIT=""
+fi
+
+if [ -z "$OUTFILE" ]; then
+  COMMIT='fun commit () = (TextIO.output (TextIO.stdErr, "Error - Database is not opened for writing.\n"); false);'
+else
+  if [ -z "$COMPRESS" ]; then
+    COMMIT="fun commit () = (TextIO.output (TextIO.stdOut, \"Exporting $OUTFILE\n\"); PolyML.export (\"$OUTFILE\", PolyML.rootFunction); true);"
+  else
+    COMMIT="fun commit () = (PolyML.shareCommonData PolyML.rootFunction; TextIO.output (TextIO.stdOut, \"Exporting $OUTFILE\n\"); PolyML.export (\"$OUTFILE\", PolyML.rootFunction); true);"
+  fi
+  [ -f "$OUTFILE" ] && { chmod +w "$OUTFILE" || fail_out; }
+  rm -f "${OUTFILE}.o" || fail_out
+fi
+
+
+## run it!
+
+MLTEXT="PolyML.Compiler.printInAlphabeticalOrder := false; $EXIT $COMMIT $MLTEXT"
+MLEXIT="commit();"
+
+if [ -z "$TERMINATE" ]; then
+  FEEDER_OPTS=""
+else
+  FEEDER_OPTS="-q"
+fi
+
+"$ISABELLE_HOME/lib/scripts/feeder" -p -h "$MLTEXT" -t "$MLEXIT" $FEEDER_OPTS | \
+  { read FPID; "$POLY" $ML_OPTIONS; RC="$?"; kill -HUP "$FPID"; exit "$RC"; }
+RC="$?"
+
+if [ -n "$OUTFILE" ]; then
+  if [ -e "${OUTFILE}.o" ]; then
+    cc -o "$OUTFILE" "${OUTFILE}.o" -L"$POLYLIB" -lpolymain -lpolyml -lstdc++ || fail_out
+    rm -f "${OUTFILE}.o"
+  fi
+  [ -f "$OUTFILE" -a -n "$NOWRITE" ] && chmod -w "$OUTFILE"
+fi
+
+exit "$RC"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Admin/Isabelle2005-polyml-5.0/src/Pure/ML-Systems/polyml-5.0.ML	Thu Dec 07 14:11:39 2006 +0100
@@ -0,0 +1,33 @@
+(*  Title:      Pure/ML-Systems/polyml-5.0.ML
+    ID:         $Id$
+
+Compatibility wrapper for Poly/ML 5.0 -- version for Isabelle2005.
+*)
+
+structure Posix =
+struct
+  open Posix;
+  structure IO =
+  struct
+    open IO;
+    val mkReader = mkTextReader;
+    val mkWriter = mkTextWriter;
+  end;
+end;
+
+structure TextIO =
+struct
+  open TextIO;
+  fun inputLine is = Option.getOpt (TextIO.inputLine is, "");
+end;
+
+structure Substring =
+struct
+  open Substring;
+  val all = full;
+end;
+
+
+use "ML-Systems/polyml.ML";
+
+val pointer_eq = PolyML.pointerEq;