src/Pure/ML-Systems/smlnj.ML
author wenzelm
Thu, 28 Feb 2002 21:35:07 +0100
changeset 12990 c11adf2b1c1e
parent 12874 368966ceafe5
child 14519 4ca3608fdf4f
permissions -rw-r--r--
renamed mask_interrupt to ignore_interrupt; renamed exhibit_interrupt to raise_interrupt; fixed interrupt handling code (more correct use of continuation);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4403
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/ML-Systems/smlnj.ML
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
     3
    Author:     Carsten Clasohm and Markus Wenzel, TU Muenchen
12874
368966ceafe5 ML-Systems/smlnj-compiler.ML compatibility tweak;
wenzelm
parents: 12581
diff changeset
     4
    License:    GPL (GNU GENERAL PUBLIC LICENSE)
4403
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
     5
5708
fb09ab6a447f dropped support for SML/NJ 109.x;
wenzelm
parents: 5090
diff changeset
     6
Compatibility file for Standard ML of New Jersey 110 or later.
4403
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
     7
*)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
     8
12874
368966ceafe5 ML-Systems/smlnj-compiler.ML compatibility tweak;
wenzelm
parents: 12581
diff changeset
     9
(case #version_id (Compiler.version) of
368966ceafe5 ML-Systems/smlnj-compiler.ML compatibility tweak;
wenzelm
parents: 12581
diff changeset
    10
  [110, x] => if x >= 35 then use "ML-Systems/smlnj-compiler.ML" else ()
368966ceafe5 ML-Systems/smlnj-compiler.ML compatibility tweak;
wenzelm
parents: 12581
diff changeset
    11
| _ => ());
368966ceafe5 ML-Systems/smlnj-compiler.ML compatibility tweak;
wenzelm
parents: 12581
diff changeset
    12
368966ceafe5 ML-Systems/smlnj-compiler.ML compatibility tweak;
wenzelm
parents: 12581
diff changeset
    13
4403
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    14
(** ML system related **)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    15
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    16
(* restore old-style character / string functions *)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    17
10725
ea048ad15283 better definitions of SML90 features
paulson
parents: 7890
diff changeset
    18
val ord     = SML90.ord;
ea048ad15283 better definitions of SML90 features
paulson
parents: 7890
diff changeset
    19
val chr     = SML90.chr;
ea048ad15283 better definitions of SML90 features
paulson
parents: 7890
diff changeset
    20
val explode = SML90.explode;
ea048ad15283 better definitions of SML90 features
paulson
parents: 7890
diff changeset
    21
val implode = SML90.implode;
4403
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    22
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    23
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    24
(* New Jersey ML parameters *)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    25
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    26
val _ =
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    27
 (Compiler.Control.Print.printLength := 1000;
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    28
  Compiler.Control.Print.printDepth := 350;
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    29
  Compiler.Control.Print.stringDepth := 250;
12581
dceea9dbdedd Redundant patterns no longer cause errors.
berghofe
parents: 12108
diff changeset
    30
  Compiler.Control.Print.signatures := 2;
dceea9dbdedd Redundant patterns no longer cause errors.
berghofe
parents: 12108
diff changeset
    31
  Compiler.Control.MC.matchRedundantError := false);
4403
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    32
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    33
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    34
(* Poly/ML emulation *)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    35
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    36
fun quit () = exit 0;
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    37
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    38
(*limit the printing depth -- divided by 2 for comparibility with Poly/ML*)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    39
fun print_depth n =
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    40
 (Compiler.Control.Print.printDepth := n div 2;
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    41
  Compiler.Control.Print.printLength := n);
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    42
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    43
5816
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
    44
(* compiler-independent timing functions *)
4403
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    45
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    46
(*Note start point for timing*)
5816
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
    47
fun startTiming() =
4403
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    48
  let val CPUtimer = Timer.startCPUTimer();
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    49
      val time = Timer.checkCPUTimer(CPUtimer)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    50
  in  (CPUtimer,time)  end;
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    51
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    52
(*Finish timing and return string*)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    53
fun endTiming (CPUtimer, {gc,sys,usr}) =
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    54
  let open Time  (*...for Time.toString, Time.+ and Time.- *)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    55
      val {gc=gc2,sys=sys2,usr=usr2} = Timer.checkCPUTimer(CPUtimer)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    56
  in  "User " ^ toString (usr2-usr) ^
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    57
      "  GC " ^ toString (gc2-gc) ^
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    58
      "  All "^ toString (sys2-sys + usr2-usr + gc2-gc) ^
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    59
      " secs"
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    60
      handle Time => ""
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    61
  end;
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    62
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    63
4977
6cec2c0ffdbf added ml_prompts;
wenzelm
parents: 4428
diff changeset
    64
(* prompts *)
6cec2c0ffdbf added ml_prompts;
wenzelm
parents: 4428
diff changeset
    65
6cec2c0ffdbf added ml_prompts;
wenzelm
parents: 4428
diff changeset
    66
fun ml_prompts p1 p2 =
6cec2c0ffdbf added ml_prompts;
wenzelm
parents: 4428
diff changeset
    67
  (Compiler.Control.primaryPrompt := p1; Compiler.Control.secondaryPrompt := p2);
6cec2c0ffdbf added ml_prompts;
wenzelm
parents: 4428
diff changeset
    68
6cec2c0ffdbf added ml_prompts;
wenzelm
parents: 4428
diff changeset
    69
4403
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    70
(* toplevel pretty printing (see also Pure/install_pp.ML) *)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    71
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    72
fun make_pp path pprint =
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    73
  let
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    74
    open Compiler.PrettyPrint;
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    75
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    76
    fun pp pps obj =
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    77
      pprint obj
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    78
        (add_string pps, begin_block pps INCONSISTENT,
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    79
          fn wd => add_break pps (wd, 0), fn () => add_newline pps,
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    80
          fn () => end_block pps);
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    81
  in
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    82
    (path, pp)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    83
  end;
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    84
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    85
fun install_pp (path, pp) = Compiler.PPTable.install_pp path pp;
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    86
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    87
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    88
(* ML command execution *)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
    89
10914
aded4ba99b88 use_text etc.: proper output of error messages;
wenzelm
parents: 10725
diff changeset
    90
fun use_text (print, err) verbose txt =
5090
75ac9b451ae0 use_text: verbose flag;
wenzelm
parents: 5038
diff changeset
    91
  let
75ac9b451ae0 use_text: verbose flag;
wenzelm
parents: 5038
diff changeset
    92
    val ref out_orig = Compiler.Control.Print.out;
75ac9b451ae0 use_text: verbose flag;
wenzelm
parents: 5038
diff changeset
    93
75ac9b451ae0 use_text: verbose flag;
wenzelm
parents: 5038
diff changeset
    94
    val out_buffer = ref ([]: string list);
75ac9b451ae0 use_text: verbose flag;
wenzelm
parents: 5038
diff changeset
    95
    val out = {say = (fn s => out_buffer := s :: ! out_buffer), flush = (fn () => ())};
10914
aded4ba99b88 use_text etc.: proper output of error messages;
wenzelm
parents: 10725
diff changeset
    96
    fun output () =
7890
0aa16bc2abdb use_text: remove last char from output;
wenzelm
parents: 7855
diff changeset
    97
      let val str = implode (rev (! out_buffer))
10914
aded4ba99b88 use_text etc.: proper output of error messages;
wenzelm
parents: 10725
diff changeset
    98
      in String.substring (str, 0, Int.max (0, size str - 1)) end;
5090
75ac9b451ae0 use_text: verbose flag;
wenzelm
parents: 5038
diff changeset
    99
  in
75ac9b451ae0 use_text: verbose flag;
wenzelm
parents: 5038
diff changeset
   100
    Compiler.Control.Print.out := out;
75ac9b451ae0 use_text: verbose flag;
wenzelm
parents: 5038
diff changeset
   101
    Compiler.Interact.useStream (TextIO.openString txt) handle exn =>
10914
aded4ba99b88 use_text etc.: proper output of error messages;
wenzelm
parents: 10725
diff changeset
   102
      (Compiler.Control.Print.out := out_orig; err (output ()); raise exn);
5090
75ac9b451ae0 use_text: verbose flag;
wenzelm
parents: 5038
diff changeset
   103
    Compiler.Control.Print.out := out_orig;
10914
aded4ba99b88 use_text etc.: proper output of error messages;
wenzelm
parents: 10725
diff changeset
   104
    if verbose then print (output ()) else ()
5090
75ac9b451ae0 use_text: verbose flag;
wenzelm
parents: 5038
diff changeset
   105
  end;
4403
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   106
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   107
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   108
5816
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   109
(** interrupts **)
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   110
12990
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   111
exception Interrupt;
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   112
5816
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   113
local
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   114
12990
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   115
fun capture f x = ((f x): unit; NONE) handle exn => SOME exn;
5816
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   116
12990
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   117
fun release NONE = ()
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   118
  | release (SOME exn) = raise exn;
5816
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   119
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   120
in
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   121
12990
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   122
fun ignore_interrupt f x =
5816
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   123
  let
12990
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   124
    val old_handler = Signals.setHandler (Signals.sigINT, Signals.IGNORE);
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   125
    val result = capture f x;
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   126
    val _ = Signals.setHandler (Signals.sigINT, old_handler);
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   127
  in release result end;
5816
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   128
12990
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   129
fun raise_interrupt f x =
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   130
  let
5816
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   131
    val interrupted = ref false;
12990
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   132
    val result = ref NONE;
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   133
    val old_handler = Signals.inqHandler Signals.sigINT;
5816
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   134
  in
12990
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   135
    SMLofNJ.Cont.callcc (fn cont =>
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   136
      (Signals.setHandler (Signals.sigINT, Signals.HANDLER (fn _ => (interrupted := true; cont)));
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   137
      result := capture f x));
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   138
    Signals.setHandler (Signals.sigINT, old_handler);
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   139
    if ! interrupted then raise Interrupt else release (! result)
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   140
  end;
5816
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   141
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   142
end;
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   143
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   144
6f3cb53502fa smart interrupt handler;
wenzelm
parents: 5708
diff changeset
   145
4403
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   146
(** OS related **)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   147
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   148
(* system command execution *)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   149
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   150
(*execute Unix command which doesn't take any input from stdin and
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   151
  sends its output to stdout; could be done more easily by Unix.execute,
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   152
  but that function doesn't use the PATH*)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   153
fun execute command =
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   154
  let
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   155
    val tmp_name = OS.FileSys.tmpName ();
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   156
    val is = (OS.Process.system (command ^ " > " ^ tmp_name); TextIO.openIn tmp_name);
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   157
    val result = TextIO.inputAll is;
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   158
  in
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   159
    TextIO.closeIn is;
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   160
    OS.FileSys.remove tmp_name;
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   161
    result
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   162
  end;
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   163
7855
092a6435afad system;
wenzelm
parents: 6227
diff changeset
   164
(*plain version; with return code*)
12990
c11adf2b1c1e renamed mask_interrupt to ignore_interrupt;
wenzelm
parents: 12874
diff changeset
   165
val system = OS.Process.system: string -> int;
7855
092a6435afad system;
wenzelm
parents: 6227
diff changeset
   166
4403
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   167
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   168
(* file handling *)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   169
6227
3198f547f8af fixed file_info;
wenzelm
parents: 5816
diff changeset
   170
(*get time of last modification*)
3198f547f8af fixed file_info;
wenzelm
parents: 5816
diff changeset
   171
fun file_info name = Time.toString (OS.FileSys.modTime name) handle _ => "";
4403
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   172
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   173
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   174
(* getenv *)
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   175
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   176
fun getenv var =
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   177
  (case OS.Process.getEnv var of
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   178
    NONE => ""
1914f727f93f Compatibility file for Standard ML of New Jersey.
wenzelm
parents:
diff changeset
   179
  | SOME txt => txt);