src/Pure/ML-Systems/polyml-old-basis.ML
author berghofe
Mon Jan 21 14:18:49 2008 +0100 (2008-01-21)
changeset 25939 ddea202704b4
parent 24564 260a65fa2900
permissions -rw-r--r--
Removed Logic.auto_rename.
wenzelm@23139
     1
(*  Title:      Pure/ML-Systems/polyml-old-basis.ML
wenzelm@23139
     2
    ID:         $Id$
wenzelm@23139
     3
wenzelm@23139
     4
Fixes for the old SML basis library (before Poly/ML 4.2.0).
wenzelm@23139
     5
*)
wenzelm@23139
     6
wenzelm@23139
     7
structure String =
wenzelm@23139
     8
struct
wenzelm@23139
     9
  fun isSuffix s1 s2 =
wenzelm@23139
    10
    let val n1 = size s1 and n2 = size s2
wenzelm@23139
    11
    in if n1 = n2 then s1 = s2 else n1 <= n2 andalso String.substring (s2, n2 - n1, n1) = s1 end;
wenzelm@24564
    12
  fun isSubstring s1 s2 =
wenzelm@24564
    13
    String.isPrefix s1 s2 orelse
wenzelm@24564
    14
      size s1 < size s2 andalso isSubstring s1 (String.extract (s2, 1, NONE)); 
wenzelm@23141
    15
  open String;
wenzelm@23139
    16
end;
wenzelm@23139
    17
wenzelm@23139
    18
structure Substring =
wenzelm@23139
    19
struct
wenzelm@23139
    20
  open Substring;
wenzelm@23139
    21
  val full = all;
wenzelm@23139
    22
end;
wenzelm@23139
    23
wenzelm@23139
    24
structure Posix =
wenzelm@23139
    25
struct
wenzelm@23139
    26
  open Posix;
wenzelm@23139
    27
  structure IO =
wenzelm@23139
    28
  struct
wenzelm@23139
    29
    open IO;
wenzelm@23139
    30
    val mkTextReader = mkReader;
wenzelm@23139
    31
    val mkTextWriter = mkWriter;
wenzelm@23139
    32
  end;
wenzelm@23139
    33
end;
wenzelm@23141
    34
wenzelm@23141
    35
structure TextIO =
wenzelm@23141
    36
struct
wenzelm@23141
    37
  open TextIO;
wenzelm@23141
    38
  fun inputLine is =
wenzelm@23141
    39
    let val s = TextIO.inputLine is
wenzelm@23141
    40
    in if s = "" then NONE else SOME s end;
wenzelm@23141
    41
end;