--- a/Admin/polyml/future/ROOT.ML Thu Aug 11 13:05:23 2011 +0200
+++ b/Admin/polyml/future/ROOT.ML Thu Aug 11 13:22:22 2011 +0200
@@ -2,9 +2,59 @@
fun exit 0 = (OS.Process.exit OS.Process.success): unit
| exit _ = OS.Process.exit OS.Process.failure;
-use "ML-Systems/polyml.ML";
+fun reraise exn =
+ (case PolyML.exceptionLocation exn of
+ NONE => raise exn
+ | SOME location => PolyML.raiseWithLocation (exn, location));
+
+exception Interrupt = SML90.Interrupt;
+val ord = SML90.ord;
+val chr = SML90.chr;
+val raw_explode = SML90.explode;
+val implode = SML90.implode;
+
+val pointer_eq = PolyML.pointerEq;
+
+val exception_trace = PolyML.exception_trace;
+
+open Thread;
+val seconds = Time.fromReal;
+use "General/exn.ML";
+use "ML-Systems/multithreading.ML";
+use "ML-Systems/multithreading_polyml.ML";
+use "ML-Systems/unsynchronized.ML";
+
+use "ML-Systems/ml_pretty.ML";
-print_depth 10;
+val pretty_ml =
+ let
+ fun convert len (PolyML.PrettyBlock (ind, _, context, prts)) =
+ let
+ fun property name default =
+ (case List.find (fn PolyML.ContextProperty (a, _) => name = a | _ => false) context of
+ SOME (PolyML.ContextProperty (_, b)) => b
+ | NONE => default);
+ val bg = property "begin" "";
+ val en = property "end" "";
+ val len' = property "length" len;
+ in ML_Pretty.Block ((bg, en), map (convert len') prts, ind) end
+ | convert len (PolyML.PrettyString s) =
+ ML_Pretty.String (s, case Int.fromString len of SOME i => i | NONE => size s)
+ | convert _ (PolyML.PrettyBreak (wd, _)) =
+ ML_Pretty.Break (if wd < 99999 then (false, wd) else (true, 2));
+ in convert "" end;
+
+fun ml_pretty (ML_Pretty.Block ((bg, en), prts, ind)) =
+ let val context =
+ (if bg = "" then [] else [PolyML.ContextProperty ("begin", bg)]) @
+ (if en = "" then [] else [PolyML.ContextProperty ("end", en)])
+ in PolyML.PrettyBlock (ind, false, context, map ml_pretty prts) end
+ | ml_pretty (ML_Pretty.String (s, len)) =
+ if len = size s then PolyML.PrettyString s
+ else PolyML.PrettyBlock
+ (0, false, [PolyML.ContextProperty ("length", Int.toString len)], [PolyML.PrettyString s])
+ | ml_pretty (ML_Pretty.Break (false, wd)) = PolyML.PrettyBreak (wd, 0)
+ | ml_pretty (ML_Pretty.Break (true, _)) = PolyML.PrettyBreak (99999, 0);
use "General/basics.ML";
use "library.ML";