SML/NJ 1.07 no longer supported!
authorwenzelm
Tue Aug 05 16:44:46 1997 +0200 (1997-08-05)
changeset 359297631fd74f41
parent 3591 412c62dd43de
child 3593 f53de7618ef8
SML/NJ 1.07 no longer supported!
src/Pure/ML-Systems/smlnj-1.07.ML
     1.1 --- a/src/Pure/ML-Systems/smlnj-1.07.ML	Tue Aug 05 16:43:54 1997 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,138 +0,0 @@
     1.4 -(*  Title:      Pure/ML-Systems/smlnj-1.07.ML
     1.5 -    ID:         $Id$
     1.6 -    Author:     Carsten Clasohm, TU Muenchen
     1.7 -    Copyright   1996  TU Muenchen
     1.8 -
     1.9 -Compatibility file for Standard ML of New Jersey, version 1.07.
    1.10 -*)
    1.11 -
    1.12 -use "basis.ML";
    1.13 -
    1.14 -
    1.15 -(*** Poly/ML emulation ***)
    1.16 -
    1.17 -fun quit () = exit 0;
    1.18 -
    1.19 -(*To limit the printing depth [divided by 2 for comparibility with Poly/ML]*)
    1.20 -fun print_depth n = (Compiler.Control.Print.printDepth := n div 2;
    1.21 -                     Compiler.Control.Print.printLength := n);
    1.22 -
    1.23 -(*Interface for toplevel pretty printers, see also Pure/install_pp.ML*)
    1.24 -
    1.25 -fun make_pp path pprint =
    1.26 -  let
    1.27 -    open Compiler.PrettyPrint;
    1.28 -
    1.29 -    fun pp pps obj =
    1.30 -      pprint obj
    1.31 -        (add_string pps, begin_block pps INCONSISTENT,
    1.32 -          fn wd => add_break pps (wd, 0), fn () => add_newline pps,
    1.33 -          fn () => end_block pps);
    1.34 -  in
    1.35 -    (path, pp)
    1.36 -  end;
    1.37 -
    1.38 -fun install_pp (path, pp) = Compiler.PPTable.install_pp path pp;
    1.39 -
    1.40 -
    1.41 -(*** New Jersey ML parameters ***)
    1.42 -
    1.43 -(* Suppresses Garbage Collection messages; doesn't work yet *)
    1.44 -(*System.Runtime.gc 0;*)
    1.45 -
    1.46 -val _ = (Compiler.Control.Print.printLength := 1000;
    1.47 -         Compiler.Control.Print.printDepth := 350;
    1.48 -         Compiler.Control.Print.stringDepth := 250;
    1.49 -         Compiler.Control.Print.signatures := 2);
    1.50 -
    1.51 -
    1.52 -(*** Character/string functions which are compatible with 0.93 and Poly/ML ***)
    1.53 -
    1.54 -fun ord s = Char.ord (String.sub(s,0));
    1.55 -val chr = str o Char.chr;
    1.56 -val explode = (map str) o String.explode;
    1.57 -val implode = String.concat;
    1.58 -
    1.59 -
    1.60 -(*** Timing functions ***)
    1.61 -
    1.62 -(*Print microseconds, suppressing trailing zeroes*)
    1.63 -fun umakestring 0 = ""
    1.64 -  | umakestring n = chr(ord "0" + n div 100000) ^
    1.65 -                    umakestring(10 * (n mod 100000));
    1.66 -
    1.67 -(*A conditional timing function: applies f to () and, if the flag is true,
    1.68 -  prints its runtime. *)
    1.69 -fun cond_timeit flag f =
    1.70 -  if flag then
    1.71 -    let fun string_of_time (System.Timer.TIME {sec, usec}) =
    1.72 -            makestring sec ^ "." ^ (if usec=0 then "0" else umakestring usec)
    1.73 -        open System.Timer;
    1.74 -        val start = start_timer()
    1.75 -        val result = f();
    1.76 -        val nongc = check_timer(start)
    1.77 -        and gc = check_timer_gc(start);
    1.78 -        val both = add_time(nongc, gc)
    1.79 -    in  print("Non GC " ^ string_of_time nongc ^
    1.80 -               "   GC " ^ string_of_time gc ^
    1.81 -               "  both "^ string_of_time both ^ " secs\n");
    1.82 -        result
    1.83 -    end
    1.84 -  else f();
    1.85 -
    1.86 -
    1.87 -(*** File handling ***)
    1.88 -
    1.89 -(*Get time of last modification; if file doesn't exist return an empty string*)
    1.90 -local
    1.91 -    open System.Timer;
    1.92 -    open System.Unsafe.SysIO;
    1.93 -in
    1.94 -  fun file_info "" = ""
    1.95 -    | file_info name = makestring (mtime (PATH name))  handle _ => "";
    1.96 -end;
    1.97 -
    1.98 -structure OS =
    1.99 -  struct
   1.100 -  structure FileSys =
   1.101 -    struct
   1.102 -    val chDir = System.Directory.cd
   1.103 -    val remove = System.Unsafe.SysIO.unlink       (*Delete a file *)
   1.104 -    val getDir = System.Directory.getWD           (*path of working directory*)
   1.105 -    end
   1.106 -  end;
   1.107 -
   1.108 -
   1.109 -
   1.110 -(*** ML command execution ***)
   1.111 -
   1.112 -
   1.113 -(*For version 109.21 and later:
   1.114 -val use_string = Compiler.Interact.useStream o TextIO.openString o implode;
   1.115 -*)
   1.116 -
   1.117 -(*For versions prior to 109.21:*)
   1.118 -fun use_string commands = 
   1.119 -   Compiler.Interact.use_stream (open_string (implode commands));
   1.120 -
   1.121 -
   1.122 -(*** System command execution ***)
   1.123 -
   1.124 -(*Execute an Unix command which doesn't take any input from stdin and
   1.125 -  sends its output to stdout.
   1.126 -  This could be done more easily by Unix.execute, but that function
   1.127 -  doesn't use the PATH.*)
   1.128 -fun execute command =
   1.129 -  let val tmp_name = "isa_converted.tmp"
   1.130 -      val is = (System.Unix.system (command ^ " > " ^ tmp_name);
   1.131 -                open_in tmp_name);
   1.132 -      val result = input (is, 999999);
   1.133 -  in close_in is;
   1.134 -     OS.FileSys.remove tmp_name;
   1.135 -     result
   1.136 -  end;
   1.137 -
   1.138 -
   1.139 -(* symbol input *)
   1.140 -
   1.141 -val needs_filtered_use = false;