src/Pure/ML-Systems/polyml.ML
changeset 17077 f5af929f0fb4
parent 16659 1cf39eba29fe
child 17824 36b2978d339a
equal deleted inserted replaced
17076:c7effdf2e2e2 17077:f5af929f0fb4
     6 Compatibility file for Poly/ML (version 4.0, 4.1, 4.1.x).
     6 Compatibility file for Poly/ML (version 4.0, 4.1, 4.1.x).
     7 *)
     7 *)
     8 
     8 
     9 (** ML system and platform related **)
     9 (** ML system and platform related **)
    10 
    10 
       
    11 (* String compatibility *)
       
    12 
       
    13 structure String =
       
    14 struct
       
    15   fun isSuffix s1 s2 =
       
    16     let val n1 = size s1 and n2 = size s2
       
    17     in if n1 = n2 then s1 = s2 else n1 <= n2 andalso String.substring (s2, n2 - n1, n1) = s1 end;
       
    18   open String;
       
    19 end;
       
    20 
       
    21 
    11 (* cygwin *)
    22 (* cygwin *)
    12 
    23 
    13 val cygwin_platform =
    24 val cygwin_platform = String.isSuffix "cygwin" ml_platform;
    14   let val n = size ml_platform
       
    15   in n >= 6 andalso String.substring (ml_platform, n - 6, 6) = "cygwin" end;
       
    16 
       
    17 fun if_cygwin f x = if cygwin_platform then f x else ();
    25 fun if_cygwin f x = if cygwin_platform then f x else ();
    18 fun unless_cygwin f x = if not cygwin_platform then f x else ();
    26 fun unless_cygwin f x = if not cygwin_platform then f x else ();
    19 
    27 
    20 
    28 
    21 (*low-level pointer equality*)
    29 (*low-level pointer equality*)