eval command line arguments;
authorwenzelm
Sat, 23 Apr 2005 19:51:11 +0200
changeset 15832 df958c7afe50
parent 15831 aa58e4ec3a1f
child 15833 78109c7012ed
eval command line arguments; tuned;
src/Pure/ML-Systems/polyml.ML
--- a/src/Pure/ML-Systems/polyml.ML	Sat Apr 23 19:51:04 2005 +0200
+++ b/src/Pure/ML-Systems/polyml.ML	Sat Apr 23 19:51:11 2005 +0200
@@ -57,15 +57,13 @@
   | drop_last [x] = []
   | drop_last (x :: xs) = x :: drop_last xs;
 
-val drop_last_char = implode o drop_last o explode;
-
 in
 
 fun use_text (print, err) verbose txt =
   let
     val in_buffer = ref (explode txt);
     val out_buffer = ref ([]: string list);
-    fun output () = drop_last_char (implode (rev (! out_buffer)));
+    fun output () = implode (drop_last (rev (! out_buffer)));
 
     fun get () =
       (case ! in_buffer of
@@ -85,6 +83,16 @@
 end;
 
 
+(*eval command line arguments*)
+local
+  fun println s =
+    (TextIO.output (TextIO.stdOut, s ^ "\n"); TextIO.flushOut TextIO.stdOut);
+  val eval = use_text (println, println) false;
+in
+  val _ = PolyML.onEntry (fn () => app eval (CommandLine.arguments ()));
+end;
+
+
 
 (** interrupts **)