src/Pure/ML-Systems/smlnj.ML
changeset 26884 67c54c53da28
parent 26504 6e87c0a60104
child 26885 cfd5eb167706
equal deleted inserted replaced
26883:ae6ae88f9240 26884:67c54c53da28
   109 fun install_pp (path, pp) = CompilerPPTable.install_pp path pp;
   109 fun install_pp (path, pp) = CompilerPPTable.install_pp path pp;
   110 
   110 
   111 
   111 
   112 (* ML command execution *)
   112 (* ML command execution *)
   113 
   113 
   114 fun use_text (tune: string -> string) (line: int, name) (print, err) verbose txt =
   114 fun use_text (tune: string -> string) _ (line: int, name) (print, err) verbose txt =
   115   let
   115   let
   116     val ref out_orig = Control.Print.out;
   116     val ref out_orig = Control.Print.out;
   117 
   117 
   118     val out_buffer = ref ([]: string list);
   118     val out_buffer = ref ([]: string list);
   119     val out = {say = (fn s => out_buffer := s :: ! out_buffer), flush = (fn () => ())};
   119     val out = {say = (fn s => out_buffer := s :: ! out_buffer), flush = (fn () => ())};
   127         err ((if name = "" then "" else "Error in " ^ name ^ "\n") ^ output ()); raise exn);
   127         err ((if name = "" then "" else "Error in " ^ name ^ "\n") ^ output ()); raise exn);
   128     Control.Print.out := out_orig;
   128     Control.Print.out := out_orig;
   129     if verbose then print (output ()) else ()
   129     if verbose then print (output ()) else ()
   130   end;
   130   end;
   131 
   131 
   132 fun use_file tune output verbose name =
   132 fun use_file tune _ output verbose name =
   133   let
   133   let
   134     val instream = TextIO.openIn name;
   134     val instream = TextIO.openIn name;
   135     val txt = Exn.release (Exn.capture TextIO.inputAll instream before TextIO.closeIn instream);
   135     val txt = Exn.release (Exn.capture TextIO.inputAll instream before TextIO.closeIn instream);
   136   in use_text tune (1, name) output verbose txt end;
   136   in use_text tune (1, name) output verbose txt end;
   137 
   137