removed obsolete Posix/Signal compatibility wrappers;
authorwenzelm
Fri, 03 Oct 2008 21:06:36 +0200
changeset 28488 18fea7e88ea1
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
--- a/src/Pure/ML-Systems/alice.ML	Fri Oct 03 20:10:44 2008 +0200
+++ b/src/Pure/ML-Systems/alice.ML	Fri Oct 03 21:06:36 2008 +0200
@@ -213,15 +213,7 @@
   end;
 end;
 
-structure Posix =
-struct
-  structure ProcEnv =
-  struct
-    fun getpid () = raise Fail "Posix.ProcEnv.getpoid undefined";
-  end;
-end;
-
-fun string_of_pid _ = raise Fail "string_of_pid undefined";
+fun process_id () = raise Fail "process_id undefined";
 
 fun getenv var =
   (case OS.Process.getEnv var of
--- a/src/Pure/ML-Systems/polyml_common.ML	Fri Oct 03 20:10:44 2008 +0200
+++ b/src/Pure/ML-Systems/polyml_common.ML	Fri Oct 03 21:06:36 2008 +0200
@@ -125,32 +125,13 @@
 
 (** OS related **)
 
-(* Posix patches *)
-
-(*This extension of the Poly/ML Signal structure is only necessary
-  because in SML/NJ, types Posix.Signal.signal and Signals.signal differ.*)
-structure IsaSignal =
-struct
-  open Signal
-  val usr1 = Posix.Signal.usr1
-  val usr2 = Posix.Signal.usr2
-  val alrm = Posix.Signal.alrm
-  val chld = Posix.Signal.chld
-  val cont = Posix.Signal.cont
-  val int  = Posix.Signal.int
-  val quit = Posix.Signal.quit
-end;
-
-
 (* current directory *)
 
 val cd = OS.FileSys.chDir;
 val pwd = OS.FileSys.getDir;
 
-
-(*Convert a process ID to a decimal string (chiefly for tracing)*)
-fun string_of_pid pid =
-  Word.fmt StringCvt.DEC (Word.fromLargeWord (Posix.Process.pidToWord pid));
+fun process_id () =
+  Word.fmt StringCvt.DEC (Word.fromLargeWord (Posix.Process.pidToWord (Posix.ProcEnv.getpid ())));
 
 
 (* getenv *)
--- a/src/Pure/ML-Systems/smlnj.ML	Fri Oct 03 20:10:44 2008 +0200
+++ b/src/Pure/ML-Systems/smlnj.ML	Fri Oct 03 21:06:36 2008 +0200
@@ -187,45 +187,6 @@
 end;
 
 
-(** Signal handling: emulation of the Poly/ML Signal structure. Note that types
-    Posix.Signal.signal and Signals.signal differ **)
-
-structure IsaSignal =
-struct
-
-datatype sig_handle = SIG_DFL | SIG_IGN | SIG_HANDLE of Signals.signal -> unit;
-
-(*From the SML/NJ documentation: "HANDLER(f) installs a handler for a
-  signal. When signal is delivered to the process, the execution state
-  of the current thread will be bundled up as a continuation k, then
-  f(signal,n,k) will be called. The number n is the number of times
-  signal has been signalled since the last time f was invoked for it."*)
-
-fun toAction SIG_DFL = Signals.DEFAULT
-  | toAction SIG_IGN = Signals.IGNORE
-  | toAction (SIG_HANDLE iu) =
-      Signals.HANDLER (fn (signo,_,cont) => (iu signo; cont));
-
-(*The types are correct, but I'm not sure about the semantics!*)
-fun fromAction Signals.DEFAULT = SIG_DFL
-  | fromAction Signals.IGNORE = SIG_IGN
-  | fromAction (Signals.HANDLER f) =
-      SIG_HANDLE (fn signo => SMLofNJ.Cont.callcc (fn k => (f (signo,0,k); ())));
-
-(*Poly/ML version has type  int * sig_handle -> sig_handle*)
-fun signal (signo, sh) = fromAction (Signals.setHandler (signo, toAction sh));
-
-val usr1 = UnixSignals.sigUSR1
-val usr2 = UnixSignals.sigUSR2
-val alrm = UnixSignals.sigALRM
-val chld = UnixSignals.sigCHLD
-val cont = UnixSignals.sigCONT
-val int = UnixSignals.sigINT
-val quit = UnixSignals.sigQUIT
-val term = UnixSignals.sigTERM
-
-end;
-
 
 (** OS related **)
 
@@ -241,8 +202,8 @@
 
 
 (*Convert a process ID to a decimal string (chiefly for tracing)*)
-fun string_of_pid pid =
-  Word.fmt StringCvt.DEC (Word.fromLargeWord (Posix.Process.pidToWord pid));
+fun process_id pid =
+  Word.fmt StringCvt.DEC (Word.fromLargeWord (Posix.Process.pidToWord (Posix.ProcEnv.getpid ())));
 
 
 (* getenv *)