tuned pointer_eq;
authorwenzelm
Wed Jun 22 19:41:30 2005 +0200 (2005-06-22)
changeset 165421259088dc448
parent 16541 d539d47cce69
child 16543 4dd8b4d1cfc3
tuned pointer_eq;
src/Pure/ML-Systems/smlnj.ML
     1.1 --- a/src/Pure/ML-Systems/smlnj.ML	Wed Jun 22 19:41:29 2005 +0200
     1.2 +++ b/src/Pure/ML-Systems/smlnj.ML	Wed Jun 22 19:41:30 2005 +0200
     1.3 @@ -9,12 +9,13 @@
     1.4    [110, x] => if x >= 35 then use "ML-Systems/smlnj-compiler.ML" else ()
     1.5  | _ => ());
     1.6  
     1.7 +
     1.8  (** ML system related **)
     1.9  
    1.10 -(* low-level pointer equality *)
    1.11 +(*low-level pointer equality*)
    1.12  
    1.13 -(*proper implementation available? This declaration may get overridden below.*)
    1.14 -fun pointer_eq (x:''a, y) = false;
    1.15 +(*dummy version -- may get overridden in smlnj-ptreql.ML*)
    1.16 +fun pointer_eq (x:'a, y) = false;
    1.17  
    1.18  (case #version_id (Compiler.version) of
    1.19    [110, x] => if x >= 49 then use "ML-Systems/smlnj-ptreql.ML" else ()
    1.20 @@ -53,8 +54,8 @@
    1.21  
    1.22  (case #version_id (Compiler.version) of
    1.23    [110, x] => if x >= 44
    1.24 -	      then use "ML-Systems/cpu-timer-basis.ML"
    1.25 -	      else use "ML-Systems/cpu-timer-gc.ML"
    1.26 +              then use "ML-Systems/cpu-timer-basis.ML"
    1.27 +              else use "ML-Systems/cpu-timer-gc.ML"
    1.28  | _ => use "ML-Systems/cpu-timer-gc.ML");
    1.29  
    1.30  
    1.31 @@ -66,16 +67,16 @@
    1.32  
    1.33  (case #version_id (Compiler.version) of
    1.34    [110, x] => if x >= 44
    1.35 -	      then use "ML-Systems/smlnj-basis-compat.ML"
    1.36 -	      else ()
    1.37 +              then use "ML-Systems/smlnj-basis-compat.ML"
    1.38 +              else ()
    1.39  | _ => ());
    1.40  
    1.41  (* toplevel pretty printing (see also Pure/install_pp.ML) *)
    1.42  
    1.43  (case #version_id (Compiler.version) of
    1.44    [110, x] => if x >= 44
    1.45 -	      then use "ML-Systems/smlnj-pp-new.ML"
    1.46 -	      else use "ML-Systems/smlnj-pp-old.ML"
    1.47 +              then use "ML-Systems/smlnj-pp-new.ML"
    1.48 +              else use "ML-Systems/smlnj-pp-old.ML"
    1.49  | _ => use "ML-Systems/smlnj-pp-old.ML");
    1.50  
    1.51  fun install_pp (path, pp) = Compiler.PPTable.install_pp path pp;
    1.52 @@ -137,7 +138,7 @@
    1.53  
    1.54  end;
    1.55  
    1.56 -(** Signal handling: emulation of the Poly/ML Signal structure. Note that types 
    1.57 +(** Signal handling: emulation of the Poly/ML Signal structure. Note that types
    1.58      Posix.Signal.signal and Signals.signal differ **)
    1.59  
    1.60  structure IsaSignal =
    1.61 @@ -145,20 +146,23 @@
    1.62  
    1.63  datatype sig_handle = SIG_DFL | SIG_IGN | SIG_HANDLE of Signals.signal -> unit;
    1.64  
    1.65 -(*From the SML/NJ documentation:
    1.66 -"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."*)
    1.67 +(*From the SML/NJ documentation: "HANDLER(f) installs a handler for a
    1.68 +  signal. When signal is delivered to the process, the execution state
    1.69 +  of the current thread will be bundled up as a continuation k, then
    1.70 +  f(signal,n,k) will be called. The number n is the number of times
    1.71 +  signal has been signalled since the last time f was invoked for it."*)
    1.72  
    1.73  fun toAction SIG_DFL = Signals.DEFAULT
    1.74    | toAction SIG_IGN = Signals.IGNORE
    1.75 -  | toAction (SIG_HANDLE iu) = 
    1.76 +  | toAction (SIG_HANDLE iu) =
    1.77        Signals.HANDLER (fn (signo,_,cont) => (iu signo; cont));
    1.78 -  
    1.79 +
    1.80  (*The types are correct, but I'm not sure about the semantics!*)
    1.81  fun fromAction Signals.DEFAULT = SIG_DFL
    1.82    | fromAction Signals.IGNORE = SIG_IGN
    1.83 -  | fromAction (Signals.HANDLER f) = 
    1.84 +  | fromAction (Signals.HANDLER f) =
    1.85        SIG_HANDLE (fn signo => SMLofNJ.Cont.callcc (fn k => (f (signo,0,k); ())));
    1.86 -    
    1.87 +
    1.88  (*Poly/ML version has type  int * sig_handle -> sig_handle*)
    1.89  fun signal (signo, sh) = fromAction (Signals.setHandler (signo, toAction sh));
    1.90