1 (**************************************************************************)
2 (* *)
3 (* OCaml *)
4 (* *)
5 (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *)
6 (* OCaml port by John Malecki and Xavier Leroy *)
7 (* *)
8 (* Copyright 1996 Institut National de Recherche en Informatique et *)
9 (* en Automatique. *)
10 (* *)
11 (* All rights reserved. This file is distributed under the terms of *)
12 (* the GNU Lesser General Public License version 2.1, with the *)
13 (* special exception on linking described in the file LICENSE. *)
14 (* *)
15 (**************************************************************************)
16
17 (********************* Basic functions and types ***********************)
18
19 (*** Miscellaneous ***)
20 val nothing : 'a -> unit
21
22 (*** Types and exceptions. ***)
23 exception Out_of_range
24
25 (*** Operations on lists. ***)
26
27 (* Remove an element from a list *)
28 val except : 'a -> 'a list -> 'a list
29
30 (* Position of an element in a list. Head of list has position 0. *)
31 val index : 'a -> 'a list -> int
32
33 (* Return the `n' first elements of `l'. *)
34 (* ### n l -> l' *)
35 val list_truncate : int -> 'a list -> 'a list
36
37 (* Separate the `n' first elements of `l' and the others. *)
38 (* ### n list -> (first, last) *)
39 val list_truncate2 : int -> 'a list -> 'a list * 'a list
40
41 (* Replace x by y in list l *)
42 (* ### x y l -> l' *)
43 val list_replace : 'a -> 'a -> 'a list -> 'a list
44
45 (*** Operations on strings. ***)
46
47 (* Remove blanks (spaces and tabs) at beginning and end of a string. *)
48 val string_trim : string -> string
49
50 (* isprefix s1 s2 returns true if s1 is a prefix of s2. *)
51 val isprefix : string -> string -> bool
52
53 (*** I/O channels ***)
54
55 type io_channel = {
56 io_in : in_channel;
57 io_out : out_channel;
58 io_fd : Unix.file_descr
59 }
60
61 val io_channel_of_descr : Unix.file_descr -> io_channel
62 val close_io : io_channel -> unit
63 val std_io : io_channel
64