1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Caml Special Light *)
|
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
|
|
|
(* Copyright 1995 Institut National de Recherche en Informatique et *)
|
|
|
|
(* Automatique. Distributed only by permission. *)
|
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
(* Miscellaneous useful types and functions *)
|
|
|
|
|
|
|
|
val fatal_error: string -> 'a
|
|
|
|
exception Fatal_error
|
|
|
|
|
|
|
|
val map_end: ('a -> 'b) -> 'a list -> 'b list -> 'b list
|
1996-01-04 04:51:11 -08:00
|
|
|
(* [map_end f l t] is [map f l @ t], just more efficient. *)
|
1995-05-04 03:15:53 -07:00
|
|
|
val for_all2: ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
|
1996-01-04 04:51:11 -08:00
|
|
|
(* Same as [List.for_all] but for a binary predicate. *)
|
|
|
|
val replicate_list: 'a -> int -> 'a list
|
|
|
|
(* [replicate_list elem n] is the list with [n] elements
|
|
|
|
all identical to [elem]. *)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
val find_in_path: string list -> string -> string
|
|
|
|
(* Search a file in a list of directories. *)
|
|
|
|
val remove_file: string -> unit
|
1996-01-04 04:51:11 -08:00
|
|
|
(* Delete the given file if it exists. Never raise an error. *)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
val create_hashtable: int -> ('a * 'b) list -> ('a, 'b) Hashtbl.t
|
|
|
|
(* Create a hashtable of the given size and fills it with the
|
|
|
|
given bindings. *)
|
|
|
|
|
|
|
|
val capitalize: string -> string
|
|
|
|
val lowercase: string -> string
|
1996-01-04 04:51:11 -08:00
|
|
|
(* Return a copy of the given string with the first character
|
|
|
|
set to uppercase or lowercase, respectively. *)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
val copy_file: in_channel -> out_channel -> unit
|
|
|
|
(* [copy_file ic oc] reads the contents of file [ic] and copies
|
|
|
|
them to [oc]. It stops when encountering EOF on [ic]. *)
|
|
|
|
val copy_file_chunk: in_channel -> out_channel -> int -> unit
|
|
|
|
(* [copy_file_chunk ic oc n] reads [n] bytes from [ic] and copies
|
|
|
|
them to [oc]. It raises [End_of_file] when encountering
|
|
|
|
EOF on [ic]. *)
|
1995-06-05 06:44:14 -07:00
|
|
|
|
|
|
|
val log2: int -> int
|
|
|
|
(* [log2 n] returns [s] such that [n = 1 lsl s]
|
|
|
|
if [n] is a power of 2*)
|
|
|
|
val align: int -> int -> int
|
|
|
|
(* [align n a] rounds [n] upwards to a multiple of [a]
|
|
|
|
(a power of 2). *)
|
1995-10-26 09:25:24 -07:00
|
|
|
val no_overflow_add: int -> int -> bool
|
|
|
|
(* [no_overflow_add n1 n2] returns [true] if the computation of
|
|
|
|
[n1 + n2] does not overflow. *)
|
|
|
|
val no_overflow_sub: int -> int -> bool
|
|
|
|
(* [no_overflow_add n1 n2] returns [true] if the computation of
|
|
|
|
[n1 - n2] does not overflow. *)
|