src/Pure/ML-Systems/polyml.ML
changeset 23139 aa899bce7c3b
parent 22144 c33450acd873
child 23826 463903573934
equal deleted inserted replaced
23138:6852373aae8a 23139:aa899bce7c3b
     1 (*  Title:      Pure/ML-Systems/polyml.ML
     1 (*  Title:      Pure/ML-Systems/polyml.ML
     2     ID:         $Id$
     2     ID:         $Id$
     3 
     3 
     4 Compatibility file for Poly/ML (version 4.0, 4.1, 4.1.x).
     4 Compatibility file for Poly/ML (version 4.1.x and 4.2.0).
     5 *)
     5 *)
     6 
     6 
     7 (** ML system and platform related **)
     7 (** ML system and platform related **)
     8 
     8 
     9 (* String compatibility *)
     9 (* String compatibility *)
    10 
       
    11 structure String =
       
    12 struct
       
    13   fun isSuffix s1 s2 =
       
    14     let val n1 = size s1 and n2 = size s2
       
    15     in if n1 = n2 then s1 = s2 else n1 <= n2 andalso String.substring (s2, n2 - n1, n1) = s1 end;
       
    16   open String;
       
    17 end;
       
    18 
       
    19 structure Substring =
       
    20 struct
       
    21   open Substring;
       
    22   val full = all;
       
    23 end;
       
    24 
       
    25 
    10 
    26 (*low-level pointer equality*)
    11 (*low-level pointer equality*)
    27 val pointer_eq = Address.wordEq;
    12 val pointer_eq = Address.wordEq;
    28 
    13 
    29 
    14 
   187   if OS.Process.isSuccess (OS.Process.system cmd) then 0 else 1;
   172   if OS.Process.isSuccess (OS.Process.system cmd) then 0 else 1;
   188 
   173 
   189 
   174 
   190 (*Convert a process ID to a decimal string (chiefly for tracing)*)
   175 (*Convert a process ID to a decimal string (chiefly for tracing)*)
   191 fun string_of_pid pid = 
   176 fun string_of_pid pid = 
   192     Word.fmt StringCvt.DEC (Word.fromLargeWord (Posix.Process.pidToWord pid));
   177   Word.fmt StringCvt.DEC (Word.fromLargeWord (Posix.Process.pidToWord pid));
   193 
   178 
   194 
   179 
   195 (* getenv *)
   180 (* getenv *)
   196 
   181 
   197 fun getenv var =
   182 fun getenv var =