# HG changeset patch # User wenzelm # Date 1223060796 -7200 # Node ID 18fea7e88ea1c0ec07f27d41f8d226ba9e38af9a # Parent 13e637e0c8762f900a22bb977bfa0b24409dc9b1 removed obsolete Posix/Signal compatibility wrappers; plain process_id function; diff -r 13e637e0c876 -r 18fea7e88ea1 src/Pure/ML-Systems/alice.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 diff -r 13e637e0c876 -r 18fea7e88ea1 src/Pure/ML-Systems/polyml_common.ML --- 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 *) diff -r 13e637e0c876 -r 18fea7e88ea1 src/Pure/ML-Systems/smlnj.ML --- 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 *)