use_text: pass file name to compiler, tuned;
authorwenzelm
Sat Jun 06 19:58:10 2009 +0200 (2009-06-06)
changeset 31471e3987b32e401
parent 31470 01e7a8bb9e5b
child 31472 d7929d74acb4
use_text: pass file name to compiler, tuned;
src/Pure/ML-Systems/compiler_polyml-5.3.ML
     1.1 --- a/src/Pure/ML-Systems/compiler_polyml-5.3.ML	Sat Jun 06 18:11:32 2009 +0200
     1.2 +++ b/src/Pure/ML-Systems/compiler_polyml-5.3.ML	Sat Jun 06 19:58:10 2009 +0200
     1.3 @@ -14,7 +14,7 @@
     1.4  fun use_text ({tune_source, name_space, str_of_pos, print, error, ...}: use_context)
     1.5      (start_line, name) verbose txt =
     1.6    let
     1.7 -    val current_line = ref start_line;
     1.8 +    val line = ref start_line;
     1.9      val in_buffer = ref (String.explode (tune_source txt));
    1.10      val out_buffer = ref ([]: string list);
    1.11      fun output () = drop_newline (implode (rev (! out_buffer)));
    1.12 @@ -22,8 +22,7 @@
    1.13      fun get () =
    1.14        (case ! in_buffer of
    1.15          [] => NONE
    1.16 -      | c :: cs =>
    1.17 -          (in_buffer := cs; if c = #"\n" then current_line := ! current_line + 1 else (); SOME c));
    1.18 +      | c :: cs => (in_buffer := cs; if c = #"\n" then line := ! line + 1 else (); SOME c));
    1.19      fun put s = out_buffer := s :: ! out_buffer;
    1.20      fun put_message {message = msg1, hard, location = {startLine = line, ...}, context} =
    1.21       (put (if hard then "Error: " else "Warning: ");
    1.22 @@ -33,9 +32,10 @@
    1.23  
    1.24      val parameters =
    1.25       [PolyML.Compiler.CPOutStream put,
    1.26 -      PolyML.Compiler.CPLineNo (fn () => ! current_line),
    1.27 +      PolyML.Compiler.CPNameSpace name_space,
    1.28        PolyML.Compiler.CPErrorMessageProc put_message,
    1.29 -      PolyML.Compiler.CPNameSpace name_space,
    1.30 +      PolyML.Compiler.CPLineNo (fn () => ! line),
    1.31 +      PolyML.Compiler.CPFileName name,
    1.32        PolyML.Compiler.CPPrintInAlphabeticalOrder false];
    1.33      val _ =
    1.34        (while not (List.null (! in_buffer)) do