use_text: pass file name to compiler, tuned;
authorwenzelm
Sat, 06 Jun 2009 19:58:10 +0200
changeset 31471 e3987b32e401
parent 31470 01e7a8bb9e5b
child 31472 d7929d74acb4
use_text: pass file name to compiler, tuned;
src/Pure/ML-Systems/compiler_polyml-5.3.ML
--- a/src/Pure/ML-Systems/compiler_polyml-5.3.ML	Sat Jun 06 18:11:32 2009 +0200
+++ b/src/Pure/ML-Systems/compiler_polyml-5.3.ML	Sat Jun 06 19:58:10 2009 +0200
@@ -14,7 +14,7 @@
 fun use_text ({tune_source, name_space, str_of_pos, print, error, ...}: use_context)
     (start_line, name) verbose txt =
   let
-    val current_line = ref start_line;
+    val line = ref start_line;
     val in_buffer = ref (String.explode (tune_source txt));
     val out_buffer = ref ([]: string list);
     fun output () = drop_newline (implode (rev (! out_buffer)));
@@ -22,8 +22,7 @@
     fun get () =
       (case ! in_buffer of
         [] => NONE
-      | c :: cs =>
-          (in_buffer := cs; if c = #"\n" then current_line := ! current_line + 1 else (); SOME c));
+      | c :: cs => (in_buffer := cs; if c = #"\n" then line := ! line + 1 else (); SOME c));
     fun put s = out_buffer := s :: ! out_buffer;
     fun put_message {message = msg1, hard, location = {startLine = line, ...}, context} =
      (put (if hard then "Error: " else "Warning: ");
@@ -33,9 +32,10 @@
 
     val parameters =
      [PolyML.Compiler.CPOutStream put,
-      PolyML.Compiler.CPLineNo (fn () => ! current_line),
+      PolyML.Compiler.CPNameSpace name_space,
       PolyML.Compiler.CPErrorMessageProc put_message,
-      PolyML.Compiler.CPNameSpace name_space,
+      PolyML.Compiler.CPLineNo (fn () => ! line),
+      PolyML.Compiler.CPFileName name,
       PolyML.Compiler.CPPrintInAlphabeticalOrder false];
     val _ =
       (while not (List.null (! in_buffer)) do