removed obsolete Posix/Signal compatibility wrappers;
authorwenzelm
Fri Oct 03 21:06:36 2008 +0200 (2008-10-03)
changeset 2848818fea7e88ea1
parent 28487 13e637e0c876
child 28489 404649964f09
removed obsolete Posix/Signal compatibility wrappers;
plain process_id function;
src/Pure/ML-Systems/alice.ML
src/Pure/ML-Systems/polyml_common.ML
src/Pure/ML-Systems/smlnj.ML
     1.1 --- a/src/Pure/ML-Systems/alice.ML	Fri Oct 03 20:10:44 2008 +0200
     1.2 +++ b/src/Pure/ML-Systems/alice.ML	Fri Oct 03 21:06:36 2008 +0200
     1.3 @@ -213,15 +213,7 @@
     1.4    end;
     1.5  end;
     1.6  
     1.7 -structure Posix =
     1.8 -struct
     1.9 -  structure ProcEnv =
    1.10 -  struct
    1.11 -    fun getpid () = raise Fail "Posix.ProcEnv.getpoid undefined";
    1.12 -  end;
    1.13 -end;
    1.14 -
    1.15 -fun string_of_pid _ = raise Fail "string_of_pid undefined";
    1.16 +fun process_id () = raise Fail "process_id undefined";
    1.17  
    1.18  fun getenv var =
    1.19    (case OS.Process.getEnv var of
     2.1 --- a/src/Pure/ML-Systems/polyml_common.ML	Fri Oct 03 20:10:44 2008 +0200
     2.2 +++ b/src/Pure/ML-Systems/polyml_common.ML	Fri Oct 03 21:06:36 2008 +0200
     2.3 @@ -125,32 +125,13 @@
     2.4  
     2.5  (** OS related **)
     2.6  
     2.7 -(* Posix patches *)
     2.8 -
     2.9 -(*This extension of the Poly/ML Signal structure is only necessary
    2.10 -  because in SML/NJ, types Posix.Signal.signal and Signals.signal differ.*)
    2.11 -structure IsaSignal =
    2.12 -struct
    2.13 -  open Signal
    2.14 -  val usr1 = Posix.Signal.usr1
    2.15 -  val usr2 = Posix.Signal.usr2
    2.16 -  val alrm = Posix.Signal.alrm
    2.17 -  val chld = Posix.Signal.chld
    2.18 -  val cont = Posix.Signal.cont
    2.19 -  val int  = Posix.Signal.int
    2.20 -  val quit = Posix.Signal.quit
    2.21 -end;
    2.22 -
    2.23 -
    2.24  (* current directory *)
    2.25  
    2.26  val cd = OS.FileSys.chDir;
    2.27  val pwd = OS.FileSys.getDir;
    2.28  
    2.29 -
    2.30 -(*Convert a process ID to a decimal string (chiefly for tracing)*)
    2.31 -fun string_of_pid pid =
    2.32 -  Word.fmt StringCvt.DEC (Word.fromLargeWord (Posix.Process.pidToWord pid));
    2.33 +fun process_id () =
    2.34 +  Word.fmt StringCvt.DEC (Word.fromLargeWord (Posix.Process.pidToWord (Posix.ProcEnv.getpid ())));
    2.35  
    2.36  
    2.37  (* getenv *)
     3.1 --- a/src/Pure/ML-Systems/smlnj.ML	Fri Oct 03 20:10:44 2008 +0200
     3.2 +++ b/src/Pure/ML-Systems/smlnj.ML	Fri Oct 03 21:06:36 2008 +0200
     3.3 @@ -187,45 +187,6 @@
     3.4  end;
     3.5  
     3.6  
     3.7 -(** Signal handling: emulation of the Poly/ML Signal structure. Note that types
     3.8 -    Posix.Signal.signal and Signals.signal differ **)
     3.9 -
    3.10 -structure IsaSignal =
    3.11 -struct
    3.12 -
    3.13 -datatype sig_handle = SIG_DFL | SIG_IGN | SIG_HANDLE of Signals.signal -> unit;
    3.14 -
    3.15 -(*From the SML/NJ documentation: "HANDLER(f) installs a handler for a
    3.16 -  signal. When signal is delivered to the process, the execution state
    3.17 -  of the current thread will be bundled up as a continuation k, then
    3.18 -  f(signal,n,k) will be called. The number n is the number of times
    3.19 -  signal has been signalled since the last time f was invoked for it."*)
    3.20 -
    3.21 -fun toAction SIG_DFL = Signals.DEFAULT
    3.22 -  | toAction SIG_IGN = Signals.IGNORE
    3.23 -  | toAction (SIG_HANDLE iu) =
    3.24 -      Signals.HANDLER (fn (signo,_,cont) => (iu signo; cont));
    3.25 -
    3.26 -(*The types are correct, but I'm not sure about the semantics!*)
    3.27 -fun fromAction Signals.DEFAULT = SIG_DFL
    3.28 -  | fromAction Signals.IGNORE = SIG_IGN
    3.29 -  | fromAction (Signals.HANDLER f) =
    3.30 -      SIG_HANDLE (fn signo => SMLofNJ.Cont.callcc (fn k => (f (signo,0,k); ())));
    3.31 -
    3.32 -(*Poly/ML version has type  int * sig_handle -> sig_handle*)
    3.33 -fun signal (signo, sh) = fromAction (Signals.setHandler (signo, toAction sh));
    3.34 -
    3.35 -val usr1 = UnixSignals.sigUSR1
    3.36 -val usr2 = UnixSignals.sigUSR2
    3.37 -val alrm = UnixSignals.sigALRM
    3.38 -val chld = UnixSignals.sigCHLD
    3.39 -val cont = UnixSignals.sigCONT
    3.40 -val int = UnixSignals.sigINT
    3.41 -val quit = UnixSignals.sigQUIT
    3.42 -val term = UnixSignals.sigTERM
    3.43 -
    3.44 -end;
    3.45 -
    3.46  
    3.47  (** OS related **)
    3.48  
    3.49 @@ -241,8 +202,8 @@
    3.50  
    3.51  
    3.52  (*Convert a process ID to a decimal string (chiefly for tracing)*)
    3.53 -fun string_of_pid pid =
    3.54 -  Word.fmt StringCvt.DEC (Word.fromLargeWord (Posix.Process.pidToWord pid));
    3.55 +fun process_id pid =
    3.56 +  Word.fmt StringCvt.DEC (Word.fromLargeWord (Posix.Process.pidToWord (Posix.ProcEnv.getpid ())));
    3.57  
    3.58  
    3.59  (* getenv *)