src/Pure/ML-Systems/polyml-experimental.ML
changeset 31312 1c00e4ff3c99
parent 30679 bcc63fcbc3ce
child 31318 133d1cfd6ae7
     1.1 --- a/src/Pure/ML-Systems/polyml-experimental.ML	Sun May 31 14:46:44 2009 +0200
     1.2 +++ b/src/Pure/ML-Systems/polyml-experimental.ML	Sun May 31 14:51:21 2009 +0200
     1.3 @@ -1,6 +1,6 @@
     1.4 -(*  Title:      Pure/ML-Systems/polyml.ML
     1.5 +(*  Title:      Pure/ML-Systems/polyml-experimental.ML
     1.6  
     1.7 -Compatibility wrapper for experimental versions of Poly/ML after 5.2.1.
     1.8 +Compatibility wrapper for Poly/ML 5.3 (SVN experimental).
     1.9  *)
    1.10  
    1.11  open Thread;
    1.12 @@ -19,58 +19,7 @@
    1.13  
    1.14  fun share_common_data () = PolyML.shareCommonData PolyML.rootFunction;
    1.15  
    1.16 -
    1.17 -(* runtime compilation *)
    1.18 -
    1.19 -local
    1.20 -
    1.21 -fun drop_newline s =
    1.22 -  if String.isSuffix "\n" s then String.substring (s, 0, size s - 1)
    1.23 -  else s;
    1.24 -
    1.25 -in
    1.26 -
    1.27 -fun use_text ({tune_source, name_space, str_of_pos, print, error, ...}: use_context)
    1.28 -    (start_line, name) verbose txt =
    1.29 -  let
    1.30 -    val current_line = ref start_line;
    1.31 -    val in_buffer = ref (String.explode (tune_source txt));
    1.32 -    val out_buffer = ref ([]: string list);
    1.33 -    fun output () = drop_newline (implode (rev (! out_buffer)));
    1.34 -
    1.35 -    fun get () =
    1.36 -      (case ! in_buffer of
    1.37 -        [] => NONE
    1.38 -      | c :: cs =>
    1.39 -          (in_buffer := cs; if c = #"\n" then current_line := ! current_line + 1 else (); SOME c));
    1.40 -    fun put s = out_buffer := s :: ! out_buffer;
    1.41 -    fun put_message {message = msg1, hard, location = {startLine = line, ...}, context} =
    1.42 -     (put (if hard then "Error: " else "Warning: ");
    1.43 -      PolyML.prettyPrint (put, 76) msg1;
    1.44 -      (case context of NONE => () | SOME msg2 => PolyML.prettyPrint (put, 76) msg2);
    1.45 -      put ("At" ^ str_of_pos line name ^ "\n"));
    1.46 -
    1.47 -    val parameters =
    1.48 -     [PolyML.Compiler.CPOutStream put,
    1.49 -      PolyML.Compiler.CPLineNo (fn () => ! current_line),
    1.50 -      PolyML.Compiler.CPErrorMessageProc put_message,
    1.51 -      PolyML.Compiler.CPNameSpace name_space,
    1.52 -      PolyML.Compiler.CPPrintInAlphabeticalOrder false];
    1.53 -    val _ =
    1.54 -      (while not (List.null (! in_buffer)) do
    1.55 -        PolyML.compiler (get, parameters) ())
    1.56 -      handle exn =>
    1.57 -       (put ("Exception- " ^ General.exnMessage exn ^ " raised");
    1.58 -        error (output ()); raise exn);
    1.59 -  in if verbose then print (output ()) else () end;
    1.60 -
    1.61 -fun use_file context verbose name =
    1.62 -  let
    1.63 -    val instream = TextIO.openIn name;
    1.64 -    val txt = Exn.release (Exn.capture TextIO.inputAll instream before TextIO.closeIn instream);
    1.65 -  in use_text context (1, name) verbose txt end;
    1.66 -
    1.67 -end;
    1.68 +use "ML-Systems/compiler_polyml-5.3.ML";
    1.69  
    1.70  
    1.71  (* toplevel pretty printing *)