added isabelle_scala_script wrapper -- NB: portable hash-bang allows exactly one executable, without additional arguments;
--- a/NEWS Wed May 22 16:47:48 2013 +0200
+++ b/NEWS Wed May 22 18:10:54 2013 +0200
@@ -250,6 +250,9 @@
* Isabelle settings variable ISABELLE_BUILD_JAVA_OPTIONS allows to
specify global resources of the JVM process run by isabelle build.
+* Toplevel executable $ISABELLE_HOME/bin/isabelle_scala_script allows
+to run Isabelle/Scala source files as standalone programs.
+
New in Isabelle2013 (February 2013)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/isabelle_scala_script Wed May 22 18:10:54 2013 +0200
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+#
+# Author: Makarius
+#
+# Isabelle/Scala script wrapper.
+
+if [ -L "$0" ]; then
+ TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
+ exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
+fi
+
+
+## settings
+
+PRG="$(basename "$0")"
+
+ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
+source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
+
+
+## main
+
+exec "$ISABELLE_TOOL" scala -howtorun:script -nocompdaemon "$@"
+
--- a/lib/Tools/install Wed May 22 16:47:48 2013 +0200
+++ b/lib/Tools/install Wed May 22 18:10:54 2013 +0200
@@ -63,7 +63,7 @@
mkdir -p "$BINDIR" || fail "Bad directory: \"$BINDIR\""
-for NAME in isabelle isabelle-process
+for NAME in isabelle isabelle-process isabelle_scala_script
do
BIN="$BINDIR/$NAME"
DIST="$DISTDIR/bin/$NAME"
--- a/src/Doc/System/Scala.thy Wed May 22 16:47:48 2013 +0200
+++ b/src/Doc/System/Scala.thy Wed May 22 18:10:54 2013 +0200
@@ -48,6 +48,7 @@
scala> isabelle.Isabelle_System.getenv("ISABELLE_HOME")
scala> val options = isabelle.Options.init()
scala> options.bool("browser_info")
+ scala> options.string("document")
\end{alltt}
*}
@@ -69,4 +70,28 @@
adding plugin components, which needs special attention since
it overrides the standard Java class loader. *}
+
+section {* Scala script wrapper *}
+
+text {* The executable @{executable
+ "$ISABELLE_HOME/bin/isabelle_scala_script"} allows to run
+ Isabelle/Scala source files stand-alone programs, by using a
+ suitable ``hash-bang'' line and executable file permissions.
+
+ The subsequent example assumes that the main Isabelle binaries have
+ been installed in some directory that is included in @{setting PATH}
+ (see also @{tool "install"}):
+
+\begin{alltt}
+#!/usr/bin/env isabelle_scala_script
+
+val options = isabelle.Options.init()
+Console.println("browser_info = " + options.bool("browser_info"))
+Console.println("document = " + options.string("document"))
+\end{alltt}
+
+ Alternatively the full @{"file"
+ "$ISABELLE_HOME/bin/isabelle_scala_script"} may be specified in
+ expanded form. *}
+
end